How to Clear the pip Cache on Your Mac (and Why It's Safe to Delete)

Yes, it's safe to deleteDiskmack safety tier: Safe to clean
~/Library/Caches/pip~/.cache/pip

Yes, the pip cache is safe to delete. It only holds copies of packages pip already downloaded, kept so a reinstall can skip the network. On a Mac it lives at ~/Library/Caches/pip, and sometimes at ~/.cache/pip if something set it up the Linux way. Clearing it frees space immediately; the only cost is that your next pip install re-downloads what it needs.

What it is

When pip installs a package, it first downloads a wheel (a prebuilt archive) or a source tarball from PyPI. Before installing, it keeps a copy in its cache so that the next time any project asks for the same version, pip can skip the download entirely. That cache is the folder you found. On macOS the default location is ~/Library/Caches/pip. Some Macs also have ~/.cache/pip, the Linux-style location. pip itself won't create it there (it ignores the XDG cache variables on macOS), so if you have that folder, a config file, a PIP_CACHE_DIR environment variable, or a script written with Linux in mind pointed pip at it. Both folders serve the same purpose, and everything on this page applies to both.

It grows because pip never cleans up after itself. Every version of every package you have ever installed leaves an archive behind, including dependencies you never asked for by name. Upgrade a package ten times and the cache holds ten copies. If you work with the scientific Python stack, a single wheel for something like torch or tensorflow runs to hundreds of megabytes, so caches of several gigabytes are common, and heavy ML setups can go well past 10 GB.

Is it safe to delete?

Delete it. Nothing installed on your system lives in the cache. Installed packages are copied into each environment's site-packages folder, which clearing the cache does not touch. Every virtualenv, conda environment, and system Python keeps working exactly as before. The cache exists purely to make reinstalls faster.

You pay it back in bandwidth on your next install. If you reinstall a package whose wheel was cached, pip downloads it again from PyPI. For most packages that takes seconds. For the big ML wheels it can take minutes on a slow connection. Prebuilt wheels have no rebuild step; source packages that need compiling will recompile, same as they did the first time. Diskmack identifies this folder automatically and cleans it the safe way.

How to check its size

In Finder: In Finder, choose Go > Go to Folder (or press Shift-Command-G), paste ~/Library/Caches/pip and press Return. Select the folder and press Command-I to see its size. Check ~/.cache/pip the same way; if Finder can't find it, that path doesn't exist on your Mac.

In Terminal:

du -sh ~/Library/Caches/pip ~/.cache/pip

The ~ expands to your home folder; if one of the paths doesn't exist, du just says so and reports the other.

How to clean it

  1. In Finder, choose Go > Go to Folder (Shift-Command-G) and enter ~/Library/Caches/pip.
  2. Press Return to open the folder.
  3. Select everything inside with Command-A and move it to the Trash with Command-Delete.
  4. Repeat for ~/.cache/pip if that folder exists on your Mac.
  5. Empty the Trash when you're ready to reclaim the space.

The official way: this tool ships its own cleanup command, which handles locks and indexes correctly.

pip cache purge (or python3 -m pip cache purge if the pip command isn't on your PATH)

pip cache purge only clears the cache belonging to the pip that ran it. If you have several Pythons (Homebrew, pyenv, conda), the Finder route above clears the shared cache folder for all of them at once.

Will it come back?

Yes, and that's by design. The cache starts refilling the moment you run pip install again, one archive per package version you touch. How fast it grows depends on your work: a small web project might add a few hundred megabytes a year, while active ML work can put back multiple gigabytes in a week. Clearing it is maintenance, not a permanent fix. If pip is part of your weekly routine, plan on doing it again in a few months.

Common questions

Will deleting the pip cache break my virtualenvs or installed packages?

No. Installed packages live inside each environment's site-packages directory. The cache only holds downloaded archives, and pip only reads it during an install to skip a download.

What's the difference between ~/Library/Caches/pip and ~/.cache/pip?

Same cache, two possible homes. On a Mac, pip defaults to ~/Library/Caches/pip and ignores XDG_CACHE_HOME. ~/.cache/pip is the Linux-style path, and it shows up when a config file, a PIP_CACHE_DIR variable, or a script written for Linux pointed pip there. Most Macs have only the first, some have both, and both are safe to clear.

Is pip cache purge better than deleting the folder in Finder?

The end result is the same. The purge command is scoped to the exact pip you ran it with, which is tidy if you have one Python. Deleting the folders directly clears the cache for every Python installation at once. Neither touches installed packages.

Does clearing the pip cache make my Mac faster?

No, it only frees disk space. The cache isn't loaded into memory and doesn't slow anything down by sitting there. Clear it for space, not for speed.

Related folders