CleanMate

All guides · macOS and Ubuntu · Updated

Python caches filling your disk: pip, conda, uv, Poetry and old virtualenvs on Mac and Ubuntu

Where pip, conda, uv, Poetry and pipx keep their caches on a Mac and on Ubuntu, how to clear them (pip cache purge, conda clean, uv cache clean), how to find old .venv folders, and what is safe to delete.

Download for macOS · Install on Ubuntu — free and open source

CleanMate on a Mac after a Smart Scan cleanup of the pip, uv and conda caches, showing the space freedCleanMate on a Mac after a Smart Scan cleanup of the pip, uv and conda caches, showing the space freed

Every Python package manager keeps a copy of what it downloads, and none of them trims it on its own. After a year of data science or web work, the pip cache holds a few GB, conda’s pkgs folder 5 to 20 GB, uv’s cache several GB, and each project’s .venv another 0.2 to 2 GB.

The caches are safe to clear: the next install downloads the packages again. Environments are different: they hold the installed packages a project runs on.

Safe to delete, and what breaks

What Where Safe?
pip cache Mac ~/Library/Caches/pip, Ubuntu ~/.cache/pip Yes, downloaded again
uv cache Mac and Ubuntu ~/.cache/uv (uv cache dir) Yes, but read the uv section
conda package archives pkgs/ inside Miniconda, Anaconda or Miniforge Yes, with conda clean
Poetry cache Mac ~/Library/Caches/pypoetry/cache and artifacts, Ubuntu ~/.cache/pypoetry/cache and artifacts Yes, downloaded again
Poetry virtualenvs .../pypoetry/virtualenvs Only those of projects you deleted
A project’s .venv inside the project Yes for old projects; pip install or uv sync makes it again
conda environments envs/ No, unless you no longer need that environment
__pycache__ inside projects Yes, Python writes it again

pip

pip cache dir        # where it is
pip cache info       # how big it is
pip cache purge      # delete everything

pip cache purge needs pip 20.1 or newer. With several Pythons, each pip shares the same cache folder, so one purge is enough.

conda, Miniforge and mamba

conda clean --all --dry-run   # see what would go
conda clean --all

--all removes the downloaded archives (.tar.bz2, .conda), the index cache and unused unpacked packages. Use conda clean --tarballs to remove only the archives. Your environments stay. To see and remove whole environments:

conda env list
conda env remove -n old-env

uv

uv cache dir
uv cache prune    # only entries no longer used
uv cache clean    # everything

On a Mac, uv installs packages into a virtualenv as APFS clones of its cache. The cache and your .venv folders share blocks, so deleting the cache frees less than its size while those environments exist.

Poetry

poetry cache list
poetry cache clear --all PyPI
poetry env list --full-path      # inside a project
poetry env remove --all          # inside a project

Poetry keeps one virtualenv per project in pypoetry/virtualenvs, named after the project folder plus a hash. When you delete a project, its environment stays. List the folder and delete the ones whose project is gone:

ls ~/Library/Caches/pypoetry/virtualenvs    # Mac
ls ~/.cache/pypoetry/virtualenvs            # Ubuntu

Old .venv folders and pycache

Find virtual environments in your projects, largest first (replace ~/Developer with where your projects live):

find ~/Developer -maxdepth 4 -name pyvenv.cfg -not -path '*/node_modules/*' 2>/dev/null \
  | xargs -n1 dirname | xargs du -sh 2>/dev/null | sort -rh | head -20

Delete the ones of projects you have not touched in months: rm -r ~/Developer/old-project/.venv. __pycache__ folders are small, but there are many:

find ~/Developer -type d -name __pycache__ -prune -exec rm -r {} +

pipx: pipx run keeps temporary environments in ~/.local/pipx/.cache (or ~/Library/Caches/pipx on a Mac). Apps installed with pipx install live in venvs; leave those.

Old Python versions installed with pyenv take 0.3 to 2 GB each: see old runtime versions.

How CleanMate does it

CleanMate lists these in Smart Scan under developer junk, each with its size, on a Mac (all macOS features) and on Ubuntu (all Ubuntu features). Nothing is removed until you confirm, and each cache is skipped while its tool runs.

CleanMate does not delete __pycache__ folders or conda environments.

More: Free up disk space on a Mac as a developer, on Ubuntu, clear cache on a Mac and on Ubuntu.

The npm, Yarn, pnpm and Bun caches have their own guide: clear the npm, Yarn, pnpm and Bun cache.

FAQ

Is pip cache purge safe? Yes. It removes only downloaded wheels and HTTP responses; installed packages are not touched. The next pip install downloads again.

Does conda clean --all delete my environments? No. It removes archives, the index cache and packages no environment uses. Delete an environment with conda env remove -n <name>.

Why did uv cache clean free less than the cache size on my Mac? uv clones files from its cache into your virtualenvs. Blocks still used by a .venv are freed only when that environment is deleted too.

Can I delete .venv in a project? Yes, if you can rebuild it: uv sync, poetry install or pip install -r requirements.txt makes it again.

Skip the commands

CleanMate runs on both systems: pick yours.

Open source — star it on GitHub: CleanMate for macOS · CleanMate for Ubuntu

How CleanMate decides what is safe to remove →