Is it safe to delete Xcode DerivedData?
What is DerivedData?
Every time Xcode builds a project it writes intermediate build files, the code index, module caches, build logs and test results into one folder per project under:
~/Library/Developer/Xcode/DerivedData
Nothing in there is a source of truth – it's all derived from your code (hence the name). On an active machine this folder commonly grows to 10-50 GB, because Xcode never cleans up projects you stopped working on.
Delete it in Terminal
rm -rf ~/Library/Developer/Xcode/DerivedData
Or delete just one project's folder – they're named ProjectName-hash.
Delete it from Xcode
- Xcode → Settings → Locations – click the arrow next to the DerivedData path to open it in Finder, delete what you want.
- For one project: Product → Clean Build Folder (⇧⌘K) removes that project's build products.
When should you not delete it?
If you're mid-debugging with breakpoints set on a huge project, deleting DerivedData means the next build and re-index takes a while. That's the whole downside – there is no data-loss risk.
CacheCleaner shows DerivedData size per project, along with device support symbols, old archives, simulator runtimes and every other cache your dev tools left behind – and deletes only what you tick.
Get CacheCleaner for Mac