How to clean Xcode DerivedData safely

DerivedData is where Xcode keeps build products and indexes, and Xcode can recreate all of it. You can delete it once Xcode and any running builds have stopped, though the next build and indexing will take longer. Leave Xcode Archives and your project folders alone, because they live elsewhere and can’t be recreated.

TL;DR

  • Short answer. Xcode can recreate everything in DerivedData, so you can delete it once Xcode and running builds have stopped. The next build takes longer.
  • Watch out for. Leave Xcode Archives and your project folders alone. They live elsewhere and can’t be recreated.
  • With Mint. Mint lists DerivedData under Safe to clean, project by project. The rows start ticked because Xcode makes all of it again.

Where DerivedData lives

By default it’s in ~/Library/Developer/Xcode/DerivedData, with one folder per project or workspace. Each folder name is the project name plus a random string, so they’re easy to tell apart. You can also get there from Xcode: open Settings, go to Locations, and click the small arrow next to the DerivedData path.

Archives sit next door in ~/Library/Developer/Xcode/Archives. They hold the builds you exported, plus the symbol files you need to read crash reports from those builds. Keep them out of this cleanup.

Simulator runtimes and device data need a different cleanup method

Why our first simulator storage count was wrong

Deleting it by hand

If one project is misbehaving, delete only that project’s folder. If you want space back, sort the folders by date and remove the ones for projects you haven’t opened in a while.

  1. Let running builds, tests and previews finish, then quit Xcode.
  2. Open the DerivedData folder and look at each folder’s name, date and size.
  3. Move the project folders you picked to the Trash.
  4. Open your current project, let Xcode index and build it, and then empty the Trash.

What Mint adds

Mint’s Disk page lists DerivedData under Safe to clean, split into rows so you can pick project by project. The rows start ticked, because Xcode makes all of it again. Let any build finish and quit Xcode before you press Clean, or untick the project you’re building.

Clean deletes the ticked rows permanently after one confirmation. Moving build output to the Trash wouldn’t free anything until you emptied the Trash. The same scan also finds simulator caches, package manager caches and node_modules folders.

How Safe to clean works

Frequently asked questions

Is it safe to delete Xcode DerivedData?

Yes, as long as nothing is building. Xcode recreates it. You pay with a slower next build and a fresh round of indexing.

Will deleting DerivedData delete my code?

No. Your source code lives in your project folder. Check the path before you delete so you don’t select a project or Archives folder by mistake.

Can the App Store edition of Mint clean DerivedData?

No. The App Store edition can’t reach ~/Library, so DerivedData cleanup is part of the Direct and Setapp editions.

See how much DerivedData you have

Run a scan in Mint, open Safe to clean, and delete the project folders you no longer need.

Scan developer files