MacDevelopers2 min read

How to clear Xcode DerivedData, archives and simulators

Xcode can use tens of gigabytes. Here is how to safely delete DerivedData, old archives, device support files and unused simulators and runtimes on your Mac.

Updated · Written by the spacerecover team

If you build apps for Apple platforms, Xcode is probably the largest thing on your Mac after your photos. Its own install is big, but the real growth comes from build output, archives, device support files and simulators. Most of it can be recovered safely.

You can see a rough total in System Settings > General > Storage > Developer.

DerivedData: build output and indexes

DerivedData holds intermediate build files, indexes and module caches for every project you have opened. It grows with every project, branch and Xcode version, and is completely regenerated when you build.

To clear it:

  1. Quit Xcode.
  2. In Finder, choose Go > Go to Folder and enter ~/Library/Developer/Xcode/DerivedData.
  3. Move the folders inside to the Trash, then empty it.

Or in Terminal:

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

Expect your next build of each project to take longer while Xcode rebuilds and re-indexes. You can see or change the DerivedData location in Xcode > Settings > Locations.

Archives: keep what you have shipped

Every time you choose Product > Archive, Xcode stores the archive, including debug symbols. You need these to symbolicate crash reports for builds you have released, so do not delete them all blindly.

  1. Open Window > Organizer and select Archives.
  2. Right-click archives for builds you never shipped, or for versions no longer in use, and choose Delete.

Archives live in ~/Library/Developer/Xcode/Archives, organised by date.

Device support files

When you connect a physical device running a new OS version, Xcode copies debug symbols for that version into ~/Library/Developer/Xcode/iOS DeviceSupport (and similar folders for watchOS and other platforms). Each one can be several gigabytes.

Delete folders for OS versions you no longer test on. If you connect a device with that version again, Xcode recreates them.

Simulators and simulator runtimes

Simulators are stored in ~/Library/Developer/CoreSimulator/Devices, with an app's data inside each simulated device. Runtimes (the simulated OS versions) are stored separately and are large.

Remove simulators for runtimes you no longer have installed:

xcrun simctl delete unavailable

Delete individual simulators in Window > Devices and Simulators > Simulators: right-click a simulator and choose Delete.

Remove simulator runtimes in Xcode > Settings > Components (called Platforms in some Xcode versions). Select a runtime you no longer need and click the minus (–) button. You can also list and delete runtimes from Terminal:

xcrun simctl runtime list
xcrun simctl runtime delete <runtime-identifier>

Reset a simulator's content instead of deleting it with Device > Erase All Content and Settings in the Simulator app.

Old Xcode versions

If you keep several Xcode versions for compatibility, each one is large. Delete the copies in /Applications you no longer need.

Caches

Xcode also keeps caches in ~/Library/Caches/com.apple.dt.Xcode, and Swift Package Manager keeps downloaded packages in ~/Library/Caches/org.swift.swiftpm. Both are rebuilt as needed. Quit Xcode before clearing them.

For other tools, such as CocoaPods, Homebrew, npm and Gradle, see clearing developer caches on a Mac.

Frequently asked questions

Is it safe to delete Xcode DerivedData?

Yes. DerivedData only contains build output, indexes and caches that Xcode regenerates. Quit Xcode first. Your next build will be slower while it rebuilds.

Can I delete Xcode archives?

You can delete archives for builds you never released. Keep archives for released versions if you need their debug symbols to read crash reports.

What is iOS DeviceSupport and can I delete it?

It contains debug symbols copied from physical devices. Delete folders for OS versions you no longer test on; Xcode recreates them when you connect a device running that version.

Want this done for you?

spacerecover finds Xcode DerivedData, archives and simulator data alongside Homebrew, npm, Gradle, CocoaPods, pip and Swift package caches, explains what rebuilds, and never touches your projects. Archives and simulators are always shown for review.

Sources and further reading

KEEP GOING