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)):

spack spec output
$ spack -C ${HOME}/spack-config-templates/0.22.0 find -x -p -v -l gromacs
-- linux-rocky9-x86_64_v4 / gcc@12.2.0 --------------------------
mna7x6q 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~sycl build_system=cmake build_type=Release generator=make openmp_max_threads=none                             /data/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gromacs/2023-mna7x6q
qpa6jjd 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~sycl build_system=cmake build_type=Release 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-qpa6jjd
chg6ffw 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~sycl 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-chg6ffw

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

spack spec output
$ spack -C ${HOME}/spack-config-templates/0.22.0 uninstall /mna7x6q
-- linux-rocky9-x86_64_v4 / gcc@12.2.0 --------------------------
mna7x6q 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.