How can I make Spack use `~/.spack_test/` instead of `~/.spack/`?
Apr 28, 11:37pm

To make Spack use ~/.spack_test/ instead of the default ~/.spack/ directory, you need to set the SPACK_ROOT environment variable to point to your desired directory. Here’s how you can do it:


1. Set SPACK_ROOT Environment Variable

Add this line to your shell configuration file (e.g., ~/.bashrc, ~/.zshrc, or ~/.bash_profile):

bash
export SPACK_ROOT=$HOME/.spack_test

Then, reload your shell configuration:

bash
source ~/.bashrc  # or the file you edited

2. Verify the Change

Check that Spack is now using the new directory:

bash
spack location --install-dir

This should return paths under ~/.spack_test/.


3. (Optional) Reinitialize Spack

If you already have Spack installed in the default location, you may want to:

  • Move or copy the contents of ~/.spack/ to ~/.spack_test/.
  • Reinstall Spack in the new location if needed.

4. (Alternative) Use --prefix for a Single Install

If you only want to change the install directory for a specific package, you can use:

bash
spack install --prefix=~/.spack_test <package>

Note: If you are using Spack in a shared environment, ensure that the new directory has the correct permissions.


Apr 28, 11:37pm

This is a shared conversation and may include unverified content that doesn't reflect Mistral AI's views. Login to resume chatting.