Roomy › Guides

How to delete Xcode DerivedData

DerivedData is usually the single biggest folder Xcode leaves on your Mac. Here's what it is, whether it's safe to delete, and how to do it.

Updated 2026-12-02 · Leia em português

What is DerivedData?

Every time you build a project, Xcode writes the compiled code, the search index, build logs and SwiftUI preview data to a folder named after the project inside:

~/Library/Developer/Xcode/DerivedData

Xcode never cleans it up on its own. Projects you deleted, renamed or cloned twice all keep their own folder, so after a year of work it's common to find 20 to 50 GB there.

Is it safe to delete?

Yes. DerivedData is a cache. Nothing in it is source code or settings you wrote. If you delete it:

Close Xcode first. Deleting the folder of a project that is building at that moment can make the build fail; just build again.

How big is yours?

Open Terminal and run:

du -sh ~/Library/Developer/Xcode/DerivedData

To see which projects take the most space:

du -sh ~/Library/Developer/Xcode/DerivedData/* | sort -h

Option 1: from Xcode

  1. Open Xcode › Settings › Locations.
  2. Click the small arrow next to the DerivedData path. Finder opens the folder.
  3. Quit Xcode, then move the project folders you don't need (or all of them) to the Trash.

Product › Clean Build Folder (⇧⌘K) is not the same thing: it only removes the build products of the project that is open, not the index, and not the folders of other projects.

Option 2: from Terminal

To delete everything at once:

rm -rf ~/Library/Developer/Xcode/DerivedData

Xcode creates the folder again the next time you build. To delete a single project, use its folder name, for example rm -rf ~/Library/Developer/Xcode/DerivedData/MyApp-abcdefgh….

Option 3: only what's stale

Deleting everything means rebuilding the project you're working on today, too. A better approach is to delete only:

Each project folder has an info.plist with the path of the project it belongs to (WorkspacePath), so you can check whether the project is still there. That's exactly what Roomy does for you: it lists every DerivedData folder with its project name and last build, flags the ones whose project was deleted, and pre-selects only the stale ones.

Other Xcode folders worth checking

Do it in one click with Roomy

Roomy finds everything in this guide, shows what's safe to remove and cleans it for you. Scanning is free.

More guides