Conda pkgs folder taking up space: safe to delete?
Where it is
~/miniconda3/pkgs~/anaconda3/pkgs~/miniforge3/pkgs~/mambaforge/pkgs~/.conda/pkgs
What it is
Every conda installation, whether Miniconda, Anaconda, Miniforge or Mambaforge, has a pkgs directory that acts as its package cache. It holds downloaded package archives and their extracted contents, which conda links into environments when you create or update them.
Why it gets so big
Conda keeps old versions after updates, and it stores both the compressed archive and the unpacked copy of each package. Data science stacks with large libraries make it grow fast.
Is it safe to delete?
Yes. Existing environments keep working because their files are hard-linked or copied into place. Future installs simply download packages again. Conda's own clean command is the tidiest route because it removes tarballs, unused packages and index caches in one go.
Tip
Since environments hard-link from pkgs, packages still used by live environments don't free much space when deleted. Removing old environments you no longer need is often the bigger win.
See how much space it uses
du -sh "$HOME/miniconda3/pkgs" "$HOME/anaconda3/pkgs" "$HOME/miniforge3/pkgs" "$HOME/mambaforge/pkgs" "$HOME/.conda/pkgs" 2>/dev/nullClean it with the tool’s own command
conda clean --allDelete it by hand
Run in Terminal. Deleting cannot be undone, so check the paths first.
rm -rf "$HOME/miniconda3/pkgs"/*
rm -rf "$HOME/anaconda3/pkgs"/*
rm -rf "$HOME/miniforge3/pkgs"/*
rm -rf "$HOME/mambaforge/pkgs"/*
rm -rf "$HOME/.conda/pkgs"/*