How to clear pip cache on Mac

It’s safe to clear pip cache on a Mac: it holds the packages pip downloaded and the wheels it built, while installed packages and virtual environments stay. With data science libraries the cache easily reaches several gigabytes. This guide shows how to clear all of it or just one package, and how to clear the uv and Poetry caches.

MacWashing, System Junk: Xcode junk, user caches, installers and logs found, 22.83 GB ready to be cleaned
  1. Open MacWashing and choose System Junk in the sidebar.
  2. Click Start Scan.
  3. Look through what it found and click Clean. Anything debatable stays unchecked.

Free trial · macOS 14 or later

Where pip keeps its cache

pip caches two things: downloaded files, like a browser does, and wheels it built from source, so it doesn’t build them again. This command shows the cache folder, by default ~/Library/Caches/pip:

python3 -m pip cache dir

And this one shows how much space it takes:

python3 -m pip cache info
Terminal: the pip cache folder and how much space it takes

On a Mac, Python is usually python3, and pip is pip3 or pip through Python (-m pip). The commands below work with any of them.

How to clear pip cache with pip cache purge

This command deletes everything in the cache: the downloaded files and the built wheels. Installed packages stay. The next install downloads them again:

python3 -m pip cache purge
Terminal: pip cache purge reports how many files it removed and their size

Remove one package from the cache

This command shows the wheels in the cache:

python3 -m pip cache list

To delete those of one package, give its name or a pattern. This example deletes the cached wheels of numpy:

python3 -m pip cache remove numpy

Downloaded files of that package stay. Only the full purge above clears them.

Clear the uv and Poetry caches

uv keeps its own cache. This command deletes the entries uv no longer uses and is safe to run now and then:

uv cache prune
Terminal: uv cache prune removes unused cache entries and shows how much

This one deletes the whole uv cache:

uv cache clean

Poetry keeps a cache per package repository. The first command lists them, the second clears the PyPI one:

poetry cache list poetry cache clear PyPI --all

With MacWashing, it’s one click

MacWashing, System Junk: Xcode junk, user caches, installers and logs found, 22.83 GB ready to be cleaned

System Junk in MacWashing lists the pip cache unchecked: clearing it is safe, but pip would have to download every package again. Check it when you need the space. The caches of your other apps are cleared in the same pass.

Free trial · macOS 14 or later

Questions and answers

Will MacWashing delete my own files when it cleans?

No. It removes only what it can match to a known app or a known kind of junk, in places apps leave files; macOS and Apple’s files are never touched. Anything debatable is marked and stays unchecked until you decide.

What about apps that are open?

If an open app holds files being cleaned, MacWashing waits for it to quit or quits it at your request, and opens it again afterwards.

Is it free?

Yes, within the free trial: System Junk and the Uninstaller free up to 25 GB in total, with no account or card needed.

Is it safe to clear pip cache?

Yes. It holds copies of packages pip can download or build again. The next install of a big package takes longer and needs the internet.

Will pip cache purge uninstall my packages?

No. Installed packages and virtual environments stay. To remove an environment, delete its folder, for example .venv in a project.

Why is the pip cache so big?

pip keeps every file it downloaded and every wheel it built, old versions too. Some machine learning packages weigh hundreds of megabytes, so a few upgrades add gigabytes.