How to clean up DerivedData, archives and simulators on your Mac
Updated
In short: Xcode, Apple's development environment for Mac and iPhone apps, keeps its data in ~/Library/Developer in your home folder. You can safely delete DerivedData: the folder holds only data that Xcode creates again the next time you open and build a project. Remove simulators, the simulated iPhones and iPads used for testing, with the xcrun simctl command, not by hand. Delete old archives only if you no longer need to analyse crash reports from those app versions; Apple recommends keeping them.
How do I find out what takes up how much space?
A command in Terminal, the app for typed commands in the Applications > Utilities folder, shows it: du -h -d 2 ~/Library/Developer | sort -h lists the folders down to the second level by size, the largest at the bottom. The command only reads and changes nothing. The main folders in there are Xcode, with DerivedData, archives and device symbols, and CoreSimulator, with your simulators.
How do I delete DerivedData?
Quit Xcode and move the folders in ~/Library/Developer/Xcode/DerivedData to the Trash. It holds one folder per project with everything Xcode derives from your source code: intermediate and finished products of builds (a build turns the code into a working app), the project's search index and the logs of builds and tests. The next time you open the project, Xcode indexes it again, and the first build afterwards takes longer because everything is compiled again. You can also remove the folders of projects you no longer open one by one and keep the current ones.
What is "iOS DeviceSupport", and can I delete it?
Yes, you can delete old versions. When you connect an iPhone, Apple Watch or Apple TV to Xcode, Xcode copies symbol files from that device to the Mac; the debugger needs them to show what runs on the device in readable form. They are stored in one folder per system version in ~/Library/Developer/Xcode/iOS DeviceSupport, watchOS DeviceSupport or tvOS DeviceSupport. Folders for system versions none of your devices runs any more can go; if you later connect a device with that version again, Xcode copies the symbols again.
How do I remove old simulators and runtimes?
- Orphaned simulators:
xcrun simctl delete unavailabledeletes every simulator the currently selected Xcode no longer supports, usually because its system version is no longer installed, with its data.xcrun simctl list devices unavailableshows which ones these are beforehand, without changing anything. Deleting them cannot be undone. - Runtimes: Runtimes are the system versions a simulator runs, such as iOS 27. Their images are not in your home folder but in a protected storage area of macOS.
xcrun simctl runtime listshows them, andxcrun simctl runtime delete --notUsedSinceDays 90 --dry-runshows which have not been used for 90 days, without deleting anything. Without--dry-run, the same command deletes them. - Caches and logs of the simulators are in
~/Library/Developer/CoreSimulator/Cachesand~/Library/Logs/CoreSimulator.
Delete simulators with simctl or in Xcode, not by hand in ~/Library/Developer/CoreSimulator/Devices.
Should I delete old Xcode archives?
Only with care. Every archive in ~/Library/Developer/Xcode/Archives holds a version of your app as you distributed it, together with its symbol files (dSYM). Xcode uses these to turn the memory addresses in a crash report into readable function names. According to Apple, you should keep the archive of every build you distribute, because without it you might not be able to analyse crash reports from that version. So only delete archives of versions nobody uses any more, and when in doubt keep the most recently released one.
Which package caches of Apple's tools can I clear?
The caches of Swift Package Manager and CocoaPods, two tools that load third-party code libraries into Xcode projects. Swift Package Manager keeps downloaded packages in ~/Library/Caches/org.swift.swiftpm, CocoaPods in ~/Library/Caches/CocoaPods; both download what is missing the next time they resolve. Leave the folder ~/Library/org.swift.swiftpm (without Caches) alone, though: it holds the configuration and the fingerprints of your packages, not a cache. Other package caches such as npm and Homebrew are covered in the guide How to clean up node_modules and package caches on your Mac.
What you should not do
- Do not delete the whole
~/Library/Developerfolder: it also holds Xcode's own data in theUserDatafolder, such as key bindings and provisioning profiles, and your simulators with their data. - Do not delete anything while Xcode is building or a simulator is running.
- Do not delete archives without checking the version if you still ship the app.
Frequently asked questions
Is it safe to delete DerivedData?
Yes. DerivedData holds only build products, intermediate files, the search index and logs, which Xcode creates again; your source code stays in the project folder. Quit Xcode first and expect the next build to take longer.
What happens if I delete iOS DeviceSupport?
Xcode copies the symbol files from the device again as soon as you connect an iPhone, Apple Watch or Apple TV with that system version.
Can I delete Xcode archives?
Apple recommends keeping the archive of every build you distribute, because it holds the symbol files for crash reports. You can remove archives of versions nobody uses any more.
How do I delete old simulators?
Run xcrun simctl delete unavailable in Terminal to delete every simulator your current Xcode no longer supports. xcrun simctl runtime delete removes unused runtimes; with --dry-run you first see what the command would affect.
Faster with SpaceBroom
In System Junk, SpaceBroom shows Xcode DerivedData, simulator caches, simulator logs, device logs copied from iPhone and iPad, and the caches of Swift Package Manager and CocoaPods with path and size, and moves what you select to the Trash. It offers Xcode archives only once they have been unchanged for at least 180 days, device symbols after 90 days; neither is preselected. SpaceBroom deletes orphaned simulators in Maintenance under "Developer Tools" with simctl delete unavailable, provided Xcode is installed: on request it first measures how many there are and how much space they take, and the command runs only after you confirm it. That is permanent. More on the rest of System Data is in the guide System Data on your Mac: what it is and how to reduce it.
More guides
- How to free up storage space on your Mac: 9 ways that workMac storage full? See what takes up space and free it up: the Trash, Downloads, large files, unused apps, old device backups and more.
- System Data on your Mac: what it is and how to reduce itSystem Data taking up many gigabytes? What the category holds, what macOS cleans up by itself and what you can safely remove.
- How to uninstall apps on your Mac completely, with no leftoversDragging an app to the Trash leaves settings, caches and background services behind. Where the leftovers are and how to remove them safely.
- How to clean up node_modules and package caches on your Macnode_modules, the caches of npm, Yarn, pnpm and pip, Homebrew and Docker: where they are, how big they get and how to clean them up safely.
- Is it safe to delete caches on your Mac?Is it safe to clear caches on a Mac? What caches are, where they are stored, what macOS clears by itself and which folders to leave alone.
- How to find large files on your MacVideos, downloads and old archives often take the most space. How to find large files with macOS Storage settings, the Finder or Terminal.
- How to find and remove duplicate files and photos on your MacDuplicate photos in your library, copies in Downloads and Documents: how to spot duplicates reliably, which copy to keep and where deleting frees nothing.