Pruneo logoPruneo

How to clear the pip, conda and uv cache on Mac

Short answer

Run pip cache purge to empty the pip cache, uv cache clean for uv and conda clean --all for conda (try it with --dry-run first). These commands don't uninstall what is already in your environments, except conda's --force-pkgs-dirs option. Old virtual environments often use the most space, and you remove those separately.

Python leaves files in several places on your Mac: a cache for each package manager, a .venv per project and Python versions you no longer use. Each package manager has its own cleanup command. This guide collects the official ones and explains what each deletes and what will be downloaded again.

Use only the sections for the tools you have installed.

pip

pip keeps download responses and the wheels it builds, so it doesn’t have to repeat the work. On a Mac, the cache is in ~/Library/Caches/pip by default. To see where it is and how much it uses:

pip cache dir
pip cache info

To delete it, or to remove just one package:

# Deletes the whole pip cache
pip cache purge

# Deletes what is kept for one package, for example numpy
pip cache remove numpy

What is installed in your environments stays the same. You only lose the stored copy: your next install may download those packages again. Depending on your setup, the command may be pip3. All the options are in the pip cache documentation.

uv

uv also has a global cache, usually in ~/.cache/uv on a Mac. To see how much it uses:

du -sh "$(uv cache dir)"

You have three ways to clean it:

# Removes only entries that are no longer used
uv cache prune

# Deletes what is kept for one package, for example ruff
uv cache clean ruff

# Deletes the whole cache
uv cache clean

Start with uv cache prune, which keeps what you still use. We tested this on a Mac with a small environment: after uv cache clean, the installed package kept working. The next things you install will be downloaded again.

conda

conda keeps downloaded packages and tarballs. With --dry-run you can see what it would delete without touching anything:

conda clean --all --dry-run

If that looks right, run it for real. It asks you to confirm before it deletes:

conda clean --all

According to the conda clean documentation, --all removes the index cache, unused packages, tarballs and logs.

To remove a whole environment you no longer use:

conda info --envs
conda env remove -n environment-name

Poetry

If you use Poetry, list its caches and empty them with the commands in its documentation:

poetry cache list
poetry cache clear --all

Your projects stay the same. Packages will be downloaded again the next time you need them.

Virtual environments you no longer use

Caches are often only part of the story. Each project with a .venv keeps its own copy of its packages, and an environment with data science or AI libraries can get big. To find them, replace ~/Projects with your projects folder. This command only measures:

find ~/Projects -type d -name ".venv" -prune -exec du -sh {} +
# Inside the project folder
rm -rf .venv

To recreate it, use python3 -m venv .venv and reinstall the dependencies, or uv sync if the project uses uv.

Python versions you no longer use

Each installed version uses its own space. Before you remove one, check that no project needs it:

# With uv
uv python list --only-installed
uv python uninstall 3.11

# With pyenv
pyenv versions
pyenv uninstall 3.11.9

Replace the number with a version from your list. Don’t touch the Python in /usr/bin or the one from macOS: it belongs to the system or to Apple’s tools.

Summary

  1. pip: pip cache info to measure and pip cache purge to empty it.
  2. uv: start with uv cache prune and use uv cache clean if you need more.
  3. conda: try conda clean --all --dry-run, then run it without that option.
  4. Poetry: poetry cache clear --all.
  5. Environments and versions: delete the ones you don’t use, after checking you can recreate them.

If you also use Node, read How to clean node_modules and npm, pnpm and yarn caches. For containers, see Docker prune on Mac. Or download Pruneo for free.

FAQ

Is it safe to run pip cache purge?

Yes. It deletes the downloads and wheels pip keeps for reuse. Packages installed in your environments stay in place. Your next install can take longer, because pip downloads them again.

Where does pip keep its cache on Mac?

By default in ~/Library/Caches/pip. Run pip cache dir to see the exact path on your Mac and pip cache info to see how much it uses.

What is the difference between uv cache clean and uv cache prune?

uv cache clean deletes the whole cache, or one package's entries if you name it. uv cache prune deletes only entries that are no longer used, so it frees less space but avoids downloading again what you still use.

Does conda clean --all break my environments?

It shouldn't break environments conda has registered: it removes unused packages, tarballs, index caches and logs. Be careful if you have environments that don't appear in conda info --envs, and don't use --force-pkgs-dirs without reading its warning.

Try it with Pruneo

Free for macOS 14 or later. Anything it cleans can be restored from quarantine.

Pruneo is for Mac

Send yourself the link and download it on your Mac. Free, no account needed.

Email it to me
Download anyway