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/1.1.1 find --install-tree local -x -p -v -l gromacs
-- linux-rocky9-x86_64_v4 / %c,cxx=gcc@12.2.0 -------------------
4yyomyz gromacs@2025.0~cp2k+cuda~cufftmp~cycle_subcounters~double+gmxapi~heffte+hwloc~intel_provided_gcc~ipo~itt~mdrun_only+mpi+nblib~nosuffix~nvshmem~opencl+openmp+plumed~relaxed_double_precision+shared~sycl build_system=cmake build_type=Release cuda_arch:=70,80,90 generator=make openmp_max_threads=none patches:=72cff27,9372c23  /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gromacs/2025.0-openmpi-5.0.5-4yyomyz

-- linux-rocky9-x86_64_v4 / %c,cxx=gcc@14.2.0 -------------------
pojdef6 gromacs@2025.0~cp2k~cuda~cycle_subcounters~double+gmxapi~heffte+hwloc~intel_provided_gcc~ipo~itt~mdrun_only+mpi+nblib~nosuffix~opencl+openmp+plumed~relaxed_double_precision+shared~sycl build_system=cmake build_type=Release generator=make openmp_max_threads=none patches:=72cff27,9372c23  /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-14.2.0/gromacs/2025.0-openmpi-5.0.5-pojdef6
==> 2 installed packages

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

spack uninstall output
$ spack -C ${HOME}/spack-config-templates/1.1.1 uninstall /4yyomyz
    -- linux-rocky9-x86_64_v4 / %c,cxx=gcc@12.2.0 -------------------
    4yyomyz gromacs@2025.0

==> 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.