Language toolchains & SDKs

How to Clear the pip Cache on Mac: 3 Methods

If you install Python packages regularly, pip quietly accumulates a cache of downloaded wheel files and source archives on your Mac. Over time this can grow to several gigabytes — space you may never think to reclaim. This guide shows you three ways to clear the pip cache on Mac: the built-in pip cache purge command, manual folder deletion, and setting up automatic cache prevention.

Why pip Caches Files (and When to Clear Them)

pip stores downloaded packages in a local cache so that reinstalling the same version of a library does not require another network round-trip. That is useful during active development, but the cache never expires on its own. Common reasons to clear it:

  • You are running low on disk space and looking for quick wins.
  • A corrupted or partially downloaded wheel is causing install failures.
  • You have finished a project and no longer need its dependencies cached.
  • You want a clean baseline before upgrading Python or pip itself.

Clearing the pip cache is safe. pip will simply re-download packages the next time you install them. Nothing about your installed environments or running code changes.

Where Does pip Store Its Cache on Mac?

pip follows the platform cache convention. On macOS 12 and later the default cache directory is:

~/Library/Caches/pip

Inside that folder you will find two subdirectories: wheels/ (pre-built binary packages) and http/ (raw HTTP responses). The wheels/ directory is usually the larger of the two.

You can confirm the exact path pip is using at any time:

pip cache dir

If you manage multiple Python versions with pyenv, Homebrew, or the official installer, each pip installation shares the same cache directory by default, so clearing it once clears it for all of them.

Method 1 — pip cache purge (Recommended)

pip 21.1 and later ships a built-in cache management command. This is the cleanest approach because pip handles the path resolution itself regardless of how Python was installed.

  1. Open Terminal (Spotlight → Terminal).
  2. Check how much space the cache is currently using:
    pip cache info
    The output shows the cache directory and the number of cached wheels.
  3. Remove all cached files:
    pip cache purge
    pip prints the number of files removed. The command exits silently if the cache is already empty.
  4. If you have multiple pip versions (e.g. pip3, pip3.11, pip3.12), run the same command for each:
    pip3 cache purge

You can also remove cached files for a specific package without touching the rest of the cache:

pip cache remove numpy

This is useful when you suspect a single corrupted wheel but do not want to force re-downloads for everything else.

Method 2 — Manual Folder Deletion

If you are running an older pip that lacks the cache subcommand, or you simply prefer working in Finder, you can delete the cache folder directly.

  1. In Finder, press Cmd + Shift + G to open the Go to Folder dialog.
  2. Type ~/Library/Caches/pip and press Return.
  3. Select the pip folder and move it to the Trash.
  4. Empty the Trash to recover the disk space.

Alternatively, do it entirely in Terminal:

rm -rf ~/Library/Caches/pip

pip recreates the directory the next time you install a package, so you do not need to create it manually.

Safety note: Only delete ~/Library/Caches/pip. Do not delete the parent ~/Library/Caches folder — that directory contains caches for many other applications.

Method 3 — Disable the Cache Going Forward (pip no-cache-dir)

If you would rather pip never write a cache in the first place — for example on a CI machine or a Mac with very limited storage — you can disable caching permanently or per-command.

Per command (one install only):

pip install --no-cache-dir requests

Permanently via pip configuration:

  1. Open or create the pip config file:
    mkdir -p ~/.config/pip
    nano ~/.config/pip/pip.conf
  2. Add the following lines:
    [global]
    no-cache-dir = true
  3. Save the file (Ctrl + O, then Ctrl + X in nano).

With this setting every pip install skips writing to the cache. The trade-off is slower installs when you reinstall the same package, since pip always downloads from the network. For most development Macs the cache is worth keeping — use this option only if disk space is a genuine constraint.

Method Comparison

Method Requires What it clears Best for
pip cache purge pip 21.1+ All cached wheels and HTTP responses Most users — clean and reversible
pip cache remove <pkg> pip 21.1+ One package's cached files Fixing a corrupted wheel
Manual rm -rf ~/Library/Caches/pip Any pip version Everything in the pip cache directory Older pip or scripting
--no-cache-dir / pip.conf Any pip version Prevents future caching CI environments, very low storage

How Much Space Can You Recover?

The size of the pip cache varies widely depending on your workflow. A Mac used primarily for data science with large packages such as PyTorch, TensorFlow, or SciPy can accumulate several gigabytes. A Mac used for lightweight web development might have only a few hundred megabytes. Run pip cache info to see the actual count before you decide whether it is worth clearing.

If you want a broader picture of what developer caches are consuming disk space alongside pip — npm, Yarn, Gradle, Xcode DerivedData, and others — Crumb surfaces all of them in a single disk map. Its one-click clean includes the pip cache directory as part of its developer cache sweep, which is convenient when you want to reclaim space across multiple tools at once without hunting down each path individually. You can download Crumb to see a full breakdown of what is using your disk before deciding what to remove.

Frequently Asked Questions

Is clearing the pip cache permanent?

Yes. Once you run pip cache purge or delete the folder, the cached files are gone. pip will re-download them automatically on the next pip install, so your environments are unaffected, but the download will take longer.

Does clearing the pip cache affect my virtual environments?

No. The pip cache is separate from your virtual environments. Packages already installed inside a venv are stored in the environment's site-packages directory, not in the cache. Clearing the cache does not uninstall anything.

Why does pip cache info show 0 packages even though the folder is large?

This can happen when the cache contains files from a different pip version or an unusual directory layout. In that case, manual deletion with rm -rf ~/Library/Caches/pip is the reliable fallback.

Summary

The fastest and most reliable way to clear the pip cache on Mac is pip cache purge — it handles path resolution automatically and works correctly with pyenv, Homebrew Python, and the official installer. For older pip versions, manual deletion of ~/Library/Caches/pip achieves the same result. If you want to prevent the cache from growing in the future, add no-cache-dir = true to your pip configuration, keeping in mind that installs will be slower. Any of these methods is safe: your installed packages and virtual environments remain completely intact.

Reclaim your disk in one click

Crumb audits your whole Mac, tells you what's safe to delete, and frees the space in seconds — private, local, and Apple-notarized.

Download Crumb for macOS

Frequently asked questions

Is clearing the pip cache permanent?
Yes. Once you run pip cache purge or delete the folder, the cached files are gone. pip will re-download them automatically on the next pip install, so your environments are unaffected, but the download will take longer.
Does clearing the pip cache affect my virtual environments?
No. The pip cache is separate from your virtual environments. Packages already installed inside a venv are stored in the environment's site-packages directory, not in the cache. Clearing the cache does not uninstall anything.
Why does pip cache info show 0 packages even though the folder is large?
This can happen when the cache contains files from a different pip version or an unusual directory layout. In that case, manual deletion with rm -rf ~/Library/Caches/pip is the reliable fallback.