How to Clear Xcode DerivedData, Archives and Device Support Files
DerivedData, module caches and old device support files are rebuildable, so they are the safest big wins on a developer's Mac. Spotless finds them under ~/Library/Developer and lets you review before cleaning.
If you build iOS or Mac apps, Xcode is probably the biggest thing on your disk that you never look at.
What each thing is
- DerivedData is build output and indexes. Always rebuildable. Deleting it is the standard “have you tried cleaning” fix.
- Module caches speed up compiling. Also rebuildable.
- iOS DeviceSupport holds symbols Xcode copied from every device and OS version you ever plugged in. Rebuilt the next time you connect that device.
- Archives are your shipped builds. They are not caches, so decide on each one.
Clearing them with Spotless
- Run a scan and open the Developer category.
- Skim the list. Everything under DerivedData and the caches is a safe bet.
- Untick Archives you want to keep.
- Clean.
What to expect afterwards
Your next build of each project is slow, because Xcode has to rebuild its indexes. After that it is back to normal. Close Xcode before cleaning so it isn’t writing into the folder you’re emptying.
What only the direct download can do
Old Simulator runtimes are often multiple gigabytes each, but they live in a root-level folder. A sandboxed App Store app cannot see them. The direct download can.
FAQ
Is it safe to delete DerivedData? Yes. DerivedData holds build products and indexes that Xcode regenerates. The cost is a slower first build afterwards.
Should I delete Archives? Only if you no longer need them. An archive is your shipped build plus its symbols. If you need to symbolicate crash logs from a release, keep that archive.
Can the App Store version clean Simulator runtimes? No. Simulator runtimes live in a root-level folder that the sandbox blocks. The direct download can reach them.