Cleaning Homebrew, npm and pip caches on a Mac
Package managers keep old downloads and versions around. Each is small, but together they add several GB of System Data. The safest approach is each tool’s own cleanup command.
Homebrew
brew cleanup -s
Removes old versions of installed formulae and clears the download cache. brew autoremove additionally removes dependencies nothing needs anymore.
npm
npm cache clean --force
Clears the npm download cache (usually under ~/.npm). Projects’ node_modules folders are separate; delete those only in projects you don’t work on, since npm install restores them.
pip
pip cache purge
Xcode and Docker
These are usually much larger. See Xcode and Docker.
All of these caches rebuild automatically, so the downside is slower first installs afterward.
McCleaner scans for free and changes nothing until you pick items to clean.
Get McCleaner
Disclosure: this guide is published by the developer of McCleaner. Scanning is free; cleaning is paid, from €1.99. Back up important data before deleting anything. Commands are provided as is.