Help · Mac storage
How to clear developer caches on a Mac.
Every package manager keeps a cache of what it has downloaded, so installs are faster next time. Most never shrink on their own. Clearing them is safe: things download again when needed, at the cost of a slower next install. Always use the tool's own command; some caches are read-only or self-indexing, and deleting their folders by hand can confuse the tool.
Not sure which ones are big? Pangalin Space Manager finds package caches and your projects' build folders, with their sizes. The scan is free and changes nothing.
To see which are big, check the paths below in Finder (Go › Go to Folder…) with Get Info, or run du -sh on them in Terminal.
Commands, tool by tool
- Homebrew (
~/Library/Caches/Homebrew):brew cleanupremoves old versions and downloads older than 120 days.brew cleanup --prune=allremoves all old downloads. Add-nto preview first. - npm (
~/.npm):npm cache clean --force. npm's cache heals itself, so this is only for reclaiming space.npm cache verifytidies it without emptying it. - pnpm (
~/Library/pnpm/store):pnpm store pruneremoves packages no project uses. pnpm says it's safe to run now and then. - Yarn:
yarn cache clean. In Yarn 2 and later, add--allto include the shared cache in~/.yarn/berry. - pip (
~/Library/Caches/pip):pip cache purge.pip cache dirshows where it is. - uv (
~/.cache/uv):uv cache pruneremoves unused entries;uv cache cleanempties it. uv asks you never to edit its cache by hand. - CocoaPods:
pod cache clean --all. - Gradle (
~/.gradle): Gradle cleans unused cache entries itself after about 30 days.gradle --stopstops background daemons that hold memory. - Cargo (
~/.cargo): recent versions clean the global cache automatically (downloads unused for 3 months). Cargo's docs say any part of its cache can be removed and it will be restored.cargo cleanin a project removes that project'stargetfolder, often the biggest part. - Go (
~/Library/Caches/go-buildand~/go/pkg/mod):go clean -cacheandgo clean -modcache. Use these rather than deleting: the module cache is read-only. - Composer (
~/Library/Caches/composeror~/.composer/cache):composer clear-cache. - Deno (
~/Library/Caches/deno):deno clean. - Dart and Flutter (
~/.pub-cache):dart pub cache clean --force. It also removes tools added withdart pub global activate; projects fetch their packages again withflutter pub get. - pre-commit (
~/.cache/pre-commit):pre-commit clean. Hook environments are rebuilt the next time the hooks run.
For Xcode's DerivedData, simulators and device support, see clearing Xcode's cache. For Docker, see Docker disk space.
Don't forget project folders
Old projects' node_modules, target, .build, Pods, vendor, _build, bin and obj folders can be bigger than any cache. They're rebuilt by an install or build, so for projects you're not working on, they can go.
Check two things first. When did you last really work on the project? A folder's modified date isn't a good guide, because every install and build changes it; the last commit is better. And is there a lockfile beside the folder, such as package-lock.json, pnpm-lock.yaml, Cargo.lock or Podfile.lock? Without one, a rebuild may install different versions from the ones you had.
When not to delete this
- While a build or install is running. Clearing a cache under it can make it fail halfway.
- Before going offline or onto a slow connection. Everything you clear downloads again on the next install.
vendorfolders committed to a project's repository. In some Go and PHP projects they're part of the source, not a cache.- Projects you're working on. Their
node_modulesortargetfolders come back, but a fresh install can pick up newer package versions than you had.
Find every developer cache, and run the right command.
Pangalin Space Manager finds package caches (npm, pip, Homebrew, Yarn, pnpm, Gradle, Maven, CocoaPods, Cargo, Go, uv, Composer, Deno, Dart and Flutter, pre-commit and more) with their sizes, and the build and dependency folders in your projects for many languages. Each project row says when you last worked on it, from its last commit or uncommitted changes (or its newest source file without git), and which lockfile sits beside it. A folder with no lockfile is never ticked for you, and Untouched for more than … › Select Them ticks only old projects that have one. Caches and project folders go to the Trash first; the space comes back when you empty the Trash. With its optional online check on, it checks the bun, Yarn and Poetry caches one package version at a time on npm or PyPI, and moves only the versions it could confirm can be downloaded again. It also lists old Python, Ruby, Java and Node versions, Android SDK parts, Unity editors and leftover JetBrains caches one row each, never ticked for you. It refuses to clear any that hold package files by hand, and points you to the right Janitor, which runs that tool's own clean-up command (including go clean -modcache for Go modules), after a confirmation that says plainly the tool deletes permanently. Janitors need a licence, because the space they free can't be measured in advance.
Free scan · The scan changes nothing · First 5 GB freed free, then $25 a year · Notarised by Apple · Apple silicon, macOS 13 or later