Clear Homebrew, language caches and Docker on a Mac
Measure these before you bother: Docker can hold a lot, while language caches and Homebrew may hold very little. If space doesn’t come back straight away, that’s often normal, and snapshots are one reason. I tested on macOS 27.2.
Homebrew
Preview first. These change nothing:
brew cleanup --dry-run
brew cleanup --prune=all --dry-run
brew autoremove --dry-run
du -sh "$(brew --cache)" "$(brew --prefix)/Cellar"Expect the previews to offer little. On Homebrew 7.0.11, the first and third listed nothing on my Mac, and the second offered 590 KB. Homebrew’s docs say it already runs cleanup after installs and upgrades, and removes downloads older than 120 days, so that fits.
The larger number is usually the Cellar, which is installed software. brew leaves
lists what you installed on purpose. Uninstalling what you no longer use is the only
thing here likely to help much, at the cost of reinstalling it later.
brew autoremove uninstalls formulae, and --prune=all empties the download
cache. To apply a cleanup, drop --dry-run. I didn’t run these for real.
Language caches
If Corepack manages your pnpm, the pnpm check below can download pnpm itself. It did
that here. On my Mac the store is at ~/Library/pnpm/store, so du -sh on that path
avoids the trap if yours is there too.
| Tool | Measure yours | Clear (I didn’t run these) |
|---|---|---|
| Go build cache | du -sh "$(go env GOCACHE)" | go clean -cache |
| Go module cache | du -sh "$(go env GOMODCACHE)" | go clean -modcache |
| npm cache | du -sh "$(npm config get cache)/_cacache" | npm cache clean --force |
| npx cache | du -sh "$(npm config get cache)/_npx" | npm cache npx rm --force |
| pnpm | du -sh "$(pnpm store path)" | pnpm store prune |
| uv | uv cache size -H | uv cache prune |
| pip | pip cache info | pip cache purge |
For scale, these ran from about 2 MB to about 700 MB each on one Mac in November 2026. Yours depends on what you build.
What each one costs, from the tool’s own docs:
- Go build cache:
go help cachesays Go deletes old entries itself. Your next builds recompile. - Go module cache: this removes downloaded dependencies, including their unpacked source. They download again when needed.
- npm cache: the docs say npm won’t remove cached data on its own, and that reclaiming disk space is the one good reason to clear it. Later installs download again.
- npx cache: this is a separate folder, and
npm cache cleandoesn’t touch it. On my Mac nearly all of~/.npmwas npx: about 713 MB, against 2.3 MB of npm cache. Tools you run withnpxdownload again. I took thenpx rmcommand from npm’s installed source. - pnpm: the docs say pruning is “not harmful” and removes only packages no project uses. A later install may download some again, so they suggest not running it too often.
- uv: the docs call
prunesafe to run periodically. They also say never to delete files from the cache by hand; useuv cache cleanto empty it.
Docker on OrbStack
I use OrbStack, so that’s what this was tested on. There’s no typical size to quote, because it depends entirely on your images.
Before you measure, check what starts with your engine. In one session, my
orb and docker checks started OrbStack, which also started the containers set to
start with it. In a later session, with the engine stopped, docker system df only
returned a connection error and orb status said “Stopped”. I don’t know what made
the difference, so I’d assume a check can start it. That matters if anything in your
stack is reachable from outside. To measure:
docker system dfDon’t take the RECLAIMABLE column at face value. In one reading, it listed 15 kB reclaimable from an 8.46 GB build cache, and pruning then removed 7.4 GB.
These delete. The first removes every image no container is using, including
ones you built yourself, so run docker images first and check you can rebuild
yours:
docker image prune -a
docker builder prune -aI ran both with -f, which skips the prompt. I’ve left it off here so Docker asks
first. They kept the images in use and all the volumes. The costs are images to pull
or rebuild and slower first builds.
Leave volumes alone unless you’ve checked them, because they can hold real data.
Docker’s docs say
docker system prune keeps volumes unless you add --volumes.
Free space didn’t rise right after pruning here. OrbStack’s FAQ says its disk file “automatically shrinks when you delete data”, and that the 8 TB size some tools show for it is only an apparent size. I don’t know whether OrbStack’s disk file or snapshots held the space, or when it came back.
Snapshots and purgeable space
If you delete a lot and free space doesn’t move, this is the first place I’d look. After I deleted 13 GB of originals I’d moved elsewhere, free space read the same seconds later, and still about the same an hour later.
Apple says Time Machine saves a snapshot about every hour and keeps it for 24 hours, plus one of your last successful backup until space is needed. It also says the space snapshots use counts as available storage. Its Mac guide says they’re removed when space is needed or when they pass 24 hours.
To see yours:
tmutil listlocalsnapshots /Disk Utility shows them too: View > Show APFS Snapshots.
Purgeable space is related but wider. Apple describes it as space macOS can free up when needed, and says you can’t remove those files by hand. So you don’t need to do anything about it.
My advice is to leave snapshots alone and give them time. If you need the space now,
these ask macOS to thin them, or delete all of them. You lose those restore
points, so first check that a real backup exists. I haven’t tested either for this
guide; the syntax is from man tmutil:
sudo tmutil thinlocalsnapshots / 21474836480 4
sudo tmutil deletelocalsnapshots /In the first, the number is the bytes to reclaim (about 20 GB here) and the 4 is
the urgency, from 1 to 4. Apple’s documented alternative is to turn off automatic
backups, wait a few minutes, and turn them back on. If you do that, don’t forget
the last step.