Quick answer
Yes, you can delete ~/Library/Developer/Xcode/DerivedData at any time: Xcode rebuilds it on the next build. Old folders in iOS DeviceSupport are also safe to remove. Keep your Archives, because they hold the dSYM files that symbolicate crash reports. Remove simulator runtimes in Xcode > Settings > Components, not in Finder.
On this page
Where Xcode keeps its data
Xcode keeps almost everything in your user Library, which Finder hides. In Finder, choose Go > Go to Folder (Shift-Command-G) and paste a path. Xcode data is often one of the biggest items in what fills a Mac and what is safe to delete.
- Build data and indexes:
~/Library/Developer/Xcode/DerivedData - App archives:
~/Library/Developer/Xcode/Archives - Device symbols:
~/Library/Developer/Xcode/iOS DeviceSupport(alsowatchOS DeviceSupport,tvOS DeviceSupportandvisionOS DeviceSupport) - Simulated devices and their apps:
~/Library/Developer/CoreSimulator/Devices - Simulator caches:
~/Library/Developer/CoreSimulator/Caches - Documentation cache:
~/Library/Developer/Xcode/DocumentationCache - Simulator runtimes: system storage that macOS protects, mounted under
/Library/Developer/CoreSimulator/Volumes
Apple's Xcode help says derived data holds "project indexes, logs, and build products" and that it "can be re-created at any time from your source files". You can move it in Xcode > Settings > Locations.
For npm, Cargo and Gradle downloads, see which developer caches are safe to delete.
Which Xcode folders are safe to delete
| Path | What it is | Safe to delete | What happens if you delete it | How to clean it |
|---|---|---|---|---|
~/ | Build products, indexes and logs for each project | Yes | The next build is a full build and Xcode indexes the project again | Quit Xcode, then delete the folder or its project subfolders |
~/ | System symbols copied from each device you connect | Yes | Xcode copies the symbols again the next time you connect that device | Delete the folders for OS versions you no longer debug |
~/ | Archived builds, each with its app binary and dSYM files | Careful | You can lose the symbols for a build you shipped, so its crash reports stay unreadable | Delete only archives of builds you never distributed, in the Organizer |
~/ | Each simulated device, with the apps and data in it | Careful | Apps, test data and settings inside those simulators are lost | xcrun simctl delete unavailable, or remove simulators in Xcode |
~/ | Caches the Simulator builds for its runtimes | Yes | The Simulator rebuilds them; the first boot is slower | Quit Xcode and Simulator, then delete the contents |
~/ | Downloaded developer documentation | Yes | Xcode rebuilds it when you open the documentation | Quit Xcode, then delete it together with DocumentationIndex |
/ | Mounted simulator runtimes (whole iOS, watchOS, tvOS or visionOS systems) | No | Not possible by hand; the storage is protected by System Integrity Protection | Xcode > Settings > Components, or xcrun simctl runtime delete |
How to clean Xcode data by hand
Quit Xcode and the Simulator app first. An Apple engineer gives the same advice: do not delete files "behind its back" while Xcode runs.
Remove DerivedData
- Open Xcode > Settings and click Locations.
- Click the small arrow next to the Derived Data path. Finder opens the folder.
- Quit Xcode.
- Move the whole
DerivedDatafolder, or only the subfolders of old projects, to the Trash.
To do the same in Terminal, run this command. It permanently deletes all build data for all projects:
rm -rf ~/Library/Developer/Xcode/DerivedDataRemove old device symbols
- In Finder, open
~/Library/Developer/Xcode/iOS DeviceSupport. - Look at the folder names. Each starts with an OS version and a build number.
- Delete the folders of versions that no device on your desk still runs.
- Repeat in the watchOS, tvOS and visionOS DeviceSupport folders if you have them.
Apple says the symbols are "specific to the operating system release, and the model and the CPU architecture of the device". After every OS update on your iPhone, Xcode copies a new set, so old sets pile up.
Remove simulators and runtimes
First, delete simulated devices whose runtime is no longer installed. This command deletes those devices and the apps and data inside them:
xcrun simctl delete unavailableThen remove runtimes you do not need:
- Open Xcode > Settings and click Components.
- Under Other Installed Platforms, find the runtimes you no longer test on. Xcode shows how much storage each one uses.
- Click the information button next to a runtime.
- Click Delete.
Or use Terminal. The first command lists the installed runtimes with their identifiers. The second deletes one runtime:
xcrun simctl runtime list
xcrun simctl runtime delete <identifier>If a runtime stays in the "Deleting" state or comes back, Apple's support team treats it as a bug: report it with Feedback Assistant. Do not try sudo rm on runtime files. The storage is protected by System Integrity Protection, so the command fails.
Remove old archives
- In Xcode, choose Window > Organizer and click Archives.
- Select an archive of a build you never sent to TestFlight, the App Store or a customer.
- Control-click it and choose Delete.
Keep every archive of a build that people use. If you need the space, first copy those archives to an external disk.
How KemptDesk handles this
The System Junk page has an Xcode junk category: DerivedData, iOS DeviceSupport and CoreSimulator/Caches. It is off by default; tick it to include it. These are caches, so KemptDesk deletes them directly.
Hidden space lists each folder under ~/Library/Developer with a colour.
DerivedData, iOS DeviceSupport and simulator caches are Safe to clean (green), but KemptDesk does not select them for you: Smart Care's Clean recommended leaves developer caches out, as System Junk does. Select them in Hidden space or tick Xcode junk. Simulated devices show in green with the note "Safe if you do not build iOS apps". Archives are Check first (amber).
KemptDesk does not run simctl and does not delete simulator runtimes. Runtimes outside your home folder are Protected.
Questions
Is it safe to delete DerivedData?
Yes. It holds build products, indexes and logs that Xcode can re-create from your source files. The only cost is a slower first build and a new index for each project.
Why does iOS DeviceSupport take so much space?
Xcode copies a set of system symbols from each device you connect, one set per OS version. After many iOS updates, the old sets stay on your Mac until you delete them.
Can I delete the Archives folder?
Only archives of builds you never shipped. Each archive holds the dSYM files for its build, and Apple says you must keep the archive of every build you distribute to read its crash reports.
How do I remove old simulator runtimes?
Use Xcode > Settings > Components, click the information button next to a runtime, and click Delete. In Terminal, xcrun simctl runtime list shows the identifiers and xcrun simctl runtime delete removes one.
Why do deleted runtimes still use disk space?
Some developers report runtimes that stay in protected system storage after deletion. Apple's support team treats this as a bug and asks for a Feedback Assistant report. Do not disable System Integrity Protection to delete the files.
Sources
- Downloading and installing additional Xcode components (Apple Developer)
- Building your app to include debugging information (Apple Developer)
- Acquiring operating system symbol information (Apple Developer)
- Adding identifiable symbol names to a crash report (Apple Developer)
- Distributing your app for beta testing and releases (Apple Developer)
- Xcode 14 Release Notes: simulator runtime disk images and simctl runtime (Apple Developer)
- Xcode Help: Locations settings (Apple)
- Xcode using 90 GB with ~/Library/Developer: answer from Apple Developer Technical Support (Apple Developer Forums)
- Orphaned simulator runtime in protected storage (Apple Developer Forums)
- How to delete iOS simulator runtimes? (Apple Developer Forums)
- Failing to permanently delete old simulator volumes (Apple Developer Forums)
- Issue with CoreSimulator cache consuming disk space (Apple Developer Forums)