Search code examples
linuxpackage-managersspack

How to change where Spack stores the spack-stage directory?


Spack by default writes (on my system) into a directory spack-stage inside /tmp/. This directory can get full when building something big (e.g. GCC itself), at least in the shared system I am using:

fatal error: error writing to /tmp/ccPlIYSg.s: No space left on device

Is there any way to tell Spack to use a different location for spack-stage?


Solution

  • According to the spack documentation you just need to specify $TMP to point to a directory of your choice.

    Builds can be faster in temporary directories on some (e.g., HPC) systems. Specifying $tempdir will ensure use of the default temporary directory (i.e., $TMP or $TMPDIR).
    Another option that prevents conflicts and potential permission issues is to specify ~/.spack/stage, which ensures each user builds in their home directory.