Skip to content

Uninstalling applications

If you want to uninstall any personally installed applications, it's best to use the variant's unique hash to do it.

Returning to our spack find command, we can add -l (show dependency hashes as well as versions) alongside the previous flags (-x (explicitly installed), -p (installation prefix) and -v (variant)). We've also added --install-tree local to limit the output to packages we've installed locally and exclude any upstream ones:

spack find output
$ spack -C ${HOME}/spack-config-templates/0.23.1 find --install-tree local -x -p -v -l gromacs
-- linux-rocky9-x86_64_v4 / gcc@12.2.0 --------------------------
melbrk7 gromacs@2023~cp2k+cuda~cufftmp~cycle_subcounters~double+gmxapi+hwloc~intel_provided_gcc~ipo~mdrun_only+mpi+nblib~nosuffix~opencl+openmp+plumed~relaxed_double_precision+shared build_system=cmake build_type=Release cuda_arch=70,80,90 generator=make openmp_max_threads=none  /data/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gromacs/2023-openmpi-5.0.3-melbrk7

-- linux-rocky9-x86_64_v4 / gcc@14.2.0 --------------------------
2wld7jf gromacs@2023~cp2k~cuda~cycle_subcounters~double+gmxapi+hwloc~intel_provided_gcc~ipo~mdrun_only+mpi+nblib~nosuffix~opencl+openmp+plumed~relaxed_double_precision+shared build_system=cmake build_type=Release generator=make openmp_max_threads=none  /data/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-14.2.0/gromacs/2023-openmpi-5.0.5-2wld7jf
==> 2 installed packages

To uninstall a specific variant, use its hash prefixed with /:

spack uninstall output
$ spack -C ${HOME}/spack-config-templates/0.23.1 uninstall /melbrk7
-- linux-rocky9-x86_64_v4 / gcc@12.2.0 --------------------------
melbrk7 gromacs@2023

==> 1 packages will be uninstalled. Do you want to proceed? [y/N]

Answer y and press enter and that variant will be uninstalled, and the associated module will also be removed.

You can find more information about additional options for the spack uninstall command by running spack uninstall -h or by referring to the official Spack documentation.