How to delete Xcode DerivedData

Updated · By the iClearer team

Short answer

Yes, it is safe to delete Xcode DerivedData. It holds build products, indexes and logs that Xcode recreates the next time you build. Quit Xcode, then run:

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

The first build of each project afterwards takes longer, and Swift packages are resolved again. Your source code and project settings are not stored there.

What DerivedData is

DerivedData is where Xcode keeps everything it generates from your projects: compiled build products, the code index, module caches, build logs and checked-out Swift packages. It lives at:

~/Library/Developer/Xcode/DerivedData

There is one folder per project, named after the project followed by a random string. Folders for projects you deleted or have not opened in a year are still there.

Check how big it is

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

To see it per project, largest last:

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

Three ways to delete it

1. Terminal

Quit Xcode first, then:

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

Xcode creates the folder again when it next opens.

2. From Xcode settings

  1. Open Xcode → Settings → Locations.
  2. Click the small arrow next to the Derived Data path. Finder opens with the folder selected.
  3. Quit Xcode, then move the DerivedData folder, or the project folders inside it, to the Trash.

3. One project only

With the project open, choose Product → Clean Build Folder or press Shift Command K. This removes the build products for that project and leaves the others alone.

What else Xcode leaves behind

WhatPathSafe to delete?
iOS DeviceSupport~/Library/Developer/Xcode/iOS DeviceSupportYes. Recreated when you connect a device.
Xcode cache~/Library/Caches/com.apple.dt.XcodeYes.
Simulator devices~/Library/Developer/CoreSimulator/DevicesUse the commands below. You lose apps and data installed in simulators.
Archives~/Library/Developer/Xcode/ArchivesKeep archives of builds you shipped. They hold the symbols for crash reports.

Remove simulators whose runtime is no longer installed:

xcrun simctl delete unavailable

List simulator runtimes and delete one you no longer test against (Xcode 15 or later):

xcrun simctl runtime list
xcrun simctl runtime delete <identifier>

You can also remove runtimes in Xcode → Settings → Components (called Platforms in Xcode 15).

iClearer clears DerivedData with one tick

iClearer’s Builders screen shows Xcode DerivedData with its size, labelled Safe because Xcode rebuilds it. iOS Simulator data is listed too, labelled Ask first. What you clean goes to the Trash, and git repositories, signing keys and .env files can never be selected.

Scanning is free on every Mac and the free plan includes 500 MB of cleanup. Unlimited cleanup starts at $29.99 per year for one Mac, with a 14-day money-back guarantee. Needs macOS 13 Ventura or later, Intel or Apple silicon.

Frequently asked questions

Is it safe to delete Xcode DerivedData?

Yes. DerivedData contains only files Xcode generates: build products, indexes, module caches and logs. Xcode recreates them on the next build. Your source code, project files and signing certificates are stored elsewhere.

Where is Xcode DerivedData located?

In ~/Library/Developer/Xcode/DerivedData, unless you changed it in Xcode → Settings → Locations. Each project has its own folder inside.

What happens after I delete DerivedData?

The next build of each project is a full build, so it takes longer, and Xcode re-indexes the project and resolves Swift packages again. After that, build times return to normal.

How often should I delete DerivedData?

When you need the space or when Xcode shows build errors that a clean build does not fix. There is no need to delete it on a schedule, because it speeds up your builds.

Does deleting DerivedData fix Xcode build errors?

Often, yes. Stale module caches and indexes in DerivedData can cause errors that do not match your code. Deleting the folder forces Xcode to rebuild everything from scratch.

Related guides