Guide

How to delete Xcode DerivedData (and when not to)

Where Xcode DerivedData lives, how to delete it from Xcode, Finder or Terminal, what happens next, and when you should leave it alone.

Updated 5 min read

DerivedData is where Xcode keeps everything it builds from your code: compiled products, intermediate files, the code index, logs and resolved Swift packages. It is safe to delete, and it is often the biggest single folder on a developer's Mac. Here is how to delete it, what happens afterwards, and when to leave it alone.

Where DerivedData lives

By default: ~/Library/Developer/Xcode/DerivedData. Inside is one folder per project, named after the project plus a long identifier, along with shared folders such as ModuleCache.noindex. To confirm the location, open Xcode → Settings → Locations and look at Derived Data.

Option 1: from Xcode

  • Current project only: choose Product → Clean Build Folder (Shift Command K). This removes the build products for the open project.
  • Everything: in Settings → Locations, click the arrow next to the Derived Data path to open the folder in Finder, then delete the project folders you want to remove.

Option 2: from Terminal

Quit Xcode first, then run:

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

This deletes everything inside DerivedData immediately, with no Trash. Double-check the path before pressing Return.

What happens next

  • The next build of each project is a full build, so it takes longer.
  • Xcode re-indexes the project, so code completion and search are slower for a few minutes.
  • Swift packages are resolved again, which may download them if they aren't in the shared cache.

When not to delete it

  • While Xcode is building or indexing. Quit Xcode or wait until it is idle.
  • Right before a deadline on a large project, when a full rebuild would cost you time you don't have.
  • As a daily habit. Deleting it constantly only slows you down. Do it when it has grown large, when you finished with old projects, or to fix a build that behaves strangely.

DerivedData is only part of it

Archives, device support files and simulators often take even more space. See Xcode taking up too much space for the full list.

Delete DerivedData per project with Roomy

Roomy's Developer cleanup lists DerivedData with its size, along with device support files, simulator caches and package manager caches. DerivedData is rated Safe because Xcode rebuilds it, device support files are rated Review, and your projects are never touched.

Frequently asked questions

Is it safe to delete Xcode DerivedData?

Yes. DerivedData only holds build products, indexes and logs that Xcode creates from your source code. Deleting it never touches your projects. The next build and index take longer while Xcode recreates them.

Where is the DerivedData folder?

By default in ~/Library/Developer/Xcode/DerivedData. To check, open Xcode → Settings → Locations; the Derived Data setting shows the path, and the arrow next to it opens the folder in Finder.

Why does DerivedData get so big?

Xcode keeps a folder for every project and branch you have built, with build products for each configuration and destination, plus Swift package checkouts and indexes. Old projects stay until you delete their folders.

Give your Mac room to breathe.
Start with a free scan.

Download Roomy, see exactly what is taking up space, and clean up to 500 MB for free. Nothing is removed until you say so.

Version 1.0.0 5 MB macOS 14 Sonoma or later Apple silicon and Intel