The Fastest Ways to Clear Xcode Caches on a Mac
Everyone knows how to clear DerivedData. The problem isn't knowing — it's that the folder rebuilds itself every single day, and you only remember it exists when the disk is already full. Here are three ways to do it, ordered by how little effort they take, plus an honest answer to "how often should I actually bother?"
1. Xcode's own Clean Build Folder
Product → Clean Build Folder (⇧⌘K) is the one most
people reach for. It's useful, but narrower than you think: it clears the
build products of the current scheme only. The index store, module
caches and every other project's folder stay untouched.
Good for "my build is behaving weirdly". Useless for "my disk is full".
2. Terminal aliases
If you live in a terminal, put these in your ~/.zshrc once:
alias dd-size='du -sh ~/Library/Developer/Xcode/DerivedData'
alias dd-clean='rm -rf ~/Library/Developer/Xcode/DerivedData'
alias sim-clean='xcrun simctl delete unavailable'
alias arch-size='du -sh ~/Library/Developer/Xcode/Archives'
Then dd-size before, dd-clean when the number
offends you.
⚠️ Quit Xcode before dd-clean. If it's running,
it will immediately start re-creating index files for open projects, and
deleting them mid-write occasionally confuses the build system.
The catch with aliases: they only clear what you told them to. Every few months some new cache directory appears — Swift Package Manager's, a new simulator runtime path — and your alias doesn't know about it.
3. A menu bar shortcut
The reason DerivedData reaches 60 GB isn't that clearing it is hard. It's that nothing reminds you. A cleanup that requires you to remember won't happen; one that shows you the number while you work will.
That's why Dev Box Cleaner has a menu bar widget: it keeps live sizes for the usual suspects — DerivedData, Archives, iOS DeviceSupport, simulator caches, npm, Yarn, CocoaPods and Homebrew caches, plus your Trash — and each row has a two-step Clean button. No app window, no terminal, no context switch. There's also a folder icon on every row if you want to look inside before deleting.
How often is actually worth it?
Cleaning too often costs you build time; too rarely costs you disk. A realistic cadence:
| What | When |
|---|---|
| DerivedData for a finished project | Right when you stop working on it |
| All of DerivedData | Monthly, or when it passes ~20 GB |
| iOS DeviceSupport | Every few months — keep only OS versions you test on |
| Archives | Keep shipped versions' dSYMs, delete the rest |
| Unavailable simulators | After every Xcode major upgrade |
| Package manager caches | Only when you actually need the space |
One nuance worth repeating: caches exist to make
things fast. Clearing them isn't free — the next build is slower, the next
npm install re-downloads. Clear when you need space, not as a
ritual.
What not to delete
- Archives of shipped builds — their dSYMs symbolicate crash reports from real users. Details in this post.
- Anything under
/Systemor/Librarythat asks for an admin password — if macOS is protecting it, it's not yours to clean. - Simulator runtimes you still test against — deleting them means a multi-GB re-download later.
See the numbers without going looking for them
Dev Box Cleaner keeps live sizes for Xcode and package manager caches right in your menu bar, so clearing them takes one click between builds. And when you want the full picture, the app maps your entire disk as a treemap — everything goes to the Trash, so it's always reversible.
Try Dev Box Cleaner free for 7 days