What is DerivedData on Mac, and is it safe to delete?
Yes, DerivedData is safe to delete. It only contains files Xcode generated from your source code, and Xcode recreates them the next time you open and build a project.
Where it is
~/Library/Developer/Xcode/DerivedDataWhat it is
DerivedData is Xcode's working folder. For each project or workspace you open, Xcode creates a subfolder holding intermediate build files, compiled products, the code index used for autocomplete and jump to definition, logs, and Swift package checkouts.
It grows because every project gets its own folder and nothing removes it when you stop working on that project. Old projects, experiments and cloned sample code all leave their build output behind.
Deleting DerivedData is also a common fix when Xcode shows stale errors or a build behaves strangely.
How big it gets
Often several GB, and tens of GB on a Mac used for regular app development.
How to clear it by hand
- Quit Xcode so it is not writing to the folder.
- In Finder, choose Go > Go to Folder and enter ~/Library/Developer/Xcode/DerivedData.
- Move the project folders you no longer need to the Trash, or remove everything with the command below. The command deletes the whole DerivedData folder, which Xcode creates again by itself.
- Empty the Trash if you used Finder.
rm -rf ~/Library/Developer/Xcode/DerivedDataWhat happens afterwards
The next build of each project is a full build, so it takes longer than usual, and Xcode re-indexes the project and resolves Swift packages again. Your source code and project settings are not touched.
How Diskzy handles it
Diskzy lists DerivedData in the Clean up tab and ticks it, unless Xcode is open, in which case it is left alone.
Related guides
- iOS DeviceSupport~/Library/Developer/Xcode/iOS DeviceSupport
- Xcode Archives~/Library/Developer/Xcode/Archives
- CoreSimulator Devices~/Library/Developer/CoreSimulator/Devices
- CoreSimulator Caches~/Library/Developer/CoreSimulator/Caches
See where your Mac's space went
Diskzy maps your disk, explains System Data and clears what's safe. Free for 72 hours, then $9 once for 2 Macs.
Try Diskzy for free