Cleaning up Xcode: DerivedData, device support and old simulators

Where Xcode keeps build data, what each folder is for, and what the next build costs after you clear it.

Xcode is one of the largest sources of regenerable data on a developer’s Mac. Most of it sits under one folder, ~/Library/Developer, and most of it can be recreated. The difference between the folders is what recreating costs you.

Quit Xcode and any running simulators before removing anything. To see what is large before you decide, run du -sh ~/Library/Developer/Xcode/* ~/Library/Developer/CoreSimulator in Terminal.

DerivedData

~/Library/Developer/Xcode/DerivedData holds build products, indexes and intermediate files for every project you have opened. It is the safest folder to clear: Xcode rebuilds it. The cost is time. The next build of each project starts from scratch, and code indexing runs again, so expect the first build and the first minutes of code completion to be slower.

If a project behaves strangely after an Xcode update, clearing its folder in DerivedData is a common first step, so removing it can also fix stale build state.

iOS DeviceSupport

~/Library/Developer/Xcode/iOS DeviceSupport holds debug symbols that Xcode copies from a physical device the first time you connect it on a given system version. Old entries for system versions you no longer use are dead weight. Xcode copies the symbols again when you next connect a device on that version, which takes a few minutes, so removal is safe but not free.

Folders such as watchOS or tvOS DeviceSupport work the same way.

Simulators

Simulator data lives in ~/Library/Developer/CoreSimulator. Two different things take up space there:

  • Runtimes. These are the downloaded simulated operating systems, often several gigabytes each. Remove ones you no longer need in Xcode’s Settings under Platforms, or list them with xcrun simctl runtime list.
  • Devices. Each simulated device stores its own apps and data. The command xcrun simctl delete unavailable removes devices whose runtime is gone. Deleting a device, or running xcrun simctl erase all, also removes the app data inside it, so do not do that if a simulator holds test data you want to keep.

Archives: keep these

~/Library/Developer/Xcode/Archives looks like more build output, but it is not disposable. Archives are what you ship, and they contain the symbols needed to make crash reports from released versions readable. Delete an archive only when you are certain you will never need to symbolicate crashes from that build.

What the next build costs

After clearing DerivedData, budget for a full rebuild of each project. After clearing DeviceSupport, budget for a symbol copy when you reconnect a device. After removing a runtime, budget for a download if you need it again. None of this is data loss, but on a slow connection or a large project it is real time.

How the app approaches developer data

The app is in pre-alpha. Its Developer Files section is designed to list folders like these with an explanation of what each one is and what recreating it costs, and to leave items whose effect is unclear unselected. The current scanner is read-only and cleanup is not built yet, so the app does not remove any of these folders today. Until it does, the commands above work without it.

Tags:XcodeDerivedDataSimulators

See what’s taking up space on your Mac

DiskJoy explains every item and removes nothing until you review it.
Download for Mac