How to Clear Xcode DerivedData on Mac (and Why It's 50 GB)
If you build iOS or macOS apps, there's a folder on your Mac quietly eating
disk space right now. It's called DerivedData, it lives deep inside
~/Library, and on an active development machine it routinely grows
to 20–100 GB. The good news: every byte of it is safe to delete.
What is DerivedData?
DerivedData is Xcode's working directory. Every time you build a project, Xcode writes its intermediate output there:
- Build products and object files for every scheme, configuration and simulator you've ever used
- The index store that powers autocomplete and jump-to-definition
- Module caches, logs and precompiled headers
The folder lives at:
~/Library/Developer/Xcode/DerivedData
Because Xcode keeps a separate subfolder for every project you've ever opened — including that repo you cloned once to look at — the folder only ever grows. A single large project can produce several gigabytes per simulator architecture.
Is it safe to delete?
Yes. DerivedData is a cache, nothing more. Xcode rebuilds whatever it needs on the next build. The only cost is that your first build afterwards is a clean build (slower), and indexing re-runs for the projects you actually still work on. You lose nothing permanent.
Three ways to clear it
1. From Xcode
For a single project: Product → Clean Build Folder
(⇧⌘K). To see and manage all of it: Xcode → Settings →
Locations, then click the small arrow next to the DerivedData path to open
it in Finder and delete what you don't need.
2. From Terminal
# see how big it is first
du -sh ~/Library/Developer/Xcode/DerivedData
# delete all of it
rm -rf ~/Library/Developer/Xcode/DerivedData
⚠️ Quit Xcode before deleting, or it may immediately re-create index files for open projects and confuse the build system mid-write.
3. With a cleaner app
The catch with manual cleaning is that DerivedData grows back — silently. A disk-space app that tracks it for you turns this from a "remember every few months" chore into a one-click habit.
Keeping it under control
- Clear DerivedData after finishing work on a project you won't touch for a while — that project's subfolder is pure dead weight.
- CI machines: wipe it between pipelines or use a dedicated build path.
- Don't move DerivedData to an external drive to "save space" — build times suffer badly on anything slower than the internal SSD.
Clean DerivedData in one click — without opening a terminal
Dev Box Cleaner shows your whole disk as a treemap, finds Xcode junk like DerivedData, Archives and iOS DeviceSupport automatically, and keeps live sizes in your menu bar so you can clear them between builds. Everything goes to the Trash first, so it's always reversible.
Try Dev Box Cleaner free for 7 days