Python Guide

Removing Python pip Caches, Poetry Caches, Conda, and Virtualenvs on Mac

Last updated: 2026-04-06

Python's package ecosystem creates caches in ~/.cache/pip, ~/Library/Caches/pypoetry, and Conda/Miniconda/Anaconda installations. Each virtualenv duplicates the Python interpreter and all installed packages, so a handful of projects can easily consume several gigabytes. Add pyenv installations, pipx environments, and tool caches from Ruff, mypy, and pre-commit, and the total grows further. These are all safe to clean — pip and Poetry will re-download packages, and virtualenvs can be recreated.

pip cache

pip stores downloaded wheel and source distribution files at ~/.cache/pip (or ~/Library/Caches/pip on older setups). This cache speeds up repeated installs but grows indefinitely. You can check its size with `pip cache info` and clear it with `pip cache purge`. CodeCleaner detects this cache automatically.

Poetry cache

Poetry stores downloaded packages at ~/Library/Caches/pypoetry. It also maintains virtualenvs under ~/Library/Caches/pypoetry/virtualenvs. These can grow to several gigabytes, especially if you use Poetry across many projects. CodeCleaner detects both the package cache and Poetry-managed virtualenvs.

Conda and Miniconda

Conda installations (Anaconda or Miniconda) store packages and environments in their own directory trees, typically under ~/anaconda3 or ~/miniconda3. Each Conda environment is a full copy of the Python interpreter plus all packages. Unused environments from old projects can consume significant space. CodeCleaner detects Conda installations and shows their total footprint.

virtualenvs, pyenv, and pipx

Per-project virtualenvs (venv, .venv, env) duplicate Python and all packages. pyenv stores multiple Python versions under ~/.pyenv/versions. pipx installs standalone tool environments under ~/.local/pipx. CodeCleaner's Dev Caches module detects all of these, and the Project Scanner finds venv/.venv folders inside projects.

Tool caches: Ruff, mypy, pre-commit

Python development tools create their own caches — Ruff at ~/.cache/ruff, mypy at ~/.cache/mypy or .mypy_cache per project, and pre-commit at ~/.cache/pre-commit. These are small individually but add up. CodeCleaner includes them in the Python cache scan.

Manual steps (Terminal)

You can do this manually with these commands, or use CodeCleaner to automate the process with a visual interface and safety checks.

pip cache purge
poetry cache clear --all .
conda clean --all
rm -rf ~/.cache/pip
rm -rf ~/Library/Caches/pypoetry

Or use CodeCleaner

CodeCleaner automates all of this with a native macOS app. It auto-detects your installed tools, scans the relevant paths in parallel, shows per-item sizes, and lets you clean safely with one click. Free scan, no account required.