Cleaning developer caches on macOS without losing anything you need

Every build tool keeps a cache. On a working machine they add up to tens of gigabytes. The rule that makes cleaning safe is narrow, and it is worth stating before any command: delete only what the tool can rebuild from scratch.

The 13 things you can delete without losing data

CategoryPathWhat rebuilding costs
Xcode build cache~/Library/Developer/Xcode/DerivedDataThe next build is a full build
Xcode intermediatesDerivedData/*/Build/Intermediates.noindexSame, but index data survives
SwiftPM cache~/Library/Caches/org.swift.swiftpmDependencies are re-resolved
CocoaPods cache~/Library/Caches/CocoaPodsPods are re-downloaded
npm download cache~/.npm/_cacachePackages are re-downloaded
pnpm store~/Library/pnpm/storeEvery package, for every project, again
Yarn cache~/Library/Caches/YarnPackages are re-downloaded
Go build cache~/Library/Caches/go-buildEvery package is recompiled
Gradle cache~/.gradle/cachesDependencies and plugins are re-downloaded
Python bytecodeany __pycache__Recompiled on the next import
Rust build outputany target/A full cargo build again
Crash and hang reports~/Library/Logs/DiagnosticReportsNothing — they are diagnostic output
Homebrew download cache~/Library/Caches/HomebrewFormulae are re-downloaded

Notice what every row has in common: the tool can regenerate it without asking you for anything. That is the whole test.

What looks like a cache and is not

Doing it by hand

Measure first, delete second:

du -sh ~/Library/Developer/Xcode/DerivedData 2>/dev/null
du -sh ~/Library/Caches/go-build ~/.gradle/caches ~/.npm/_cacache 2>/dev/null

Then remove only what you actually need the space from:

rm -rf ~/Library/Developer/Xcode/DerivedData/*
rm -rf ~/Library/Caches/go-build/*

Two cautions nobody mentions until they bite: quit Xcode before removing DerivedData (a running build will keep writing into it), and never delete a cache while its tool is running.

Why we quarantine before we delete

A cache is safe to delete in principle. The interesting failures are the ones where the rule is slightly wrong for your setup: a project pinned to an old cache, a tool that keeps state in there, an archive you had forgotten was an archive.

So the app never deletes on the first pass. It measures, moves the payload into a quarantine folder, and starts a 30-day clock. If something breaks inside that window, one click restores it. Permanent deletion happens only after the window, is off by default, and requires six conditions to hold at once — fail any one and it aborts.

What to expect

For an actively used iOS project, DerivedData is usually the single biggest item (5–50 GB). Node and Rust caches are commonly 1–10 GB each; Gradle and Go a few GB. If your total is under a gigabyte, cleaning is not your disk problem — the Storage panel will show you what actually is.

See where your space actually went first. DisplayPilot's Storage panel breaks the disk down by category, tells you which of the 13 groups are worth cleaning, and quarantines everything for 30 days before it removes anything. 14-day trial, every feature, no account.

Download for macOS

← Back to home