Why Xcode takes so much space, and how to get it back
Xcode itself is large, but most of the space it uses is outside the app: build output in DerivedData, symbol files for every iOS version you have plugged in, simulator devices and runtimes, and archives of every build you shipped. Almost all of it lives in ~/Library/Developer, and most of it can be rebuilt.
Below are the exact folders, the command or menu that clears each one, and what deleting it costs you. Quit Xcode and the Simulator before you start.
See where the space is going
Before deleting anything, measure. This command prints the size of each folder Xcode and the Simulator keep in your Library. It only reads sizes.
On most developer Macs the top entries are CoreSimulator and Xcode, and inside Xcode the largest folders are DerivedData, iOS DeviceSupport and Archives.
du -sh ~/Library/Developer/* ~/Library/Developer/Xcode/* 2>/dev/null | sort -hDerivedData: build output and indexes
Path: ~/Library/Developer/Xcode/DerivedData. Xcode creates one folder here per project or workspace, holding compiled objects, the module cache, the code index, build logs and the Swift packages it checked out for that project. Folders for projects you deleted long ago stay behind.
This is the safest thing to remove and usually the biggest. The command below deletes everything inside DerivedData, for all projects. You can also open the folder in Finder and remove only the projects you no longer work on.
What it costs: the next build of each project is a full build, Xcode re-indexes the code, and Swift packages are resolved again. You lose no source code and no settings.
rm -rf ~/Library/Developer/Xcode/DerivedData/*DeviceSupport: symbols for devices you plugged in
Path: ~/Library/Developer/Xcode/iOS DeviceSupport, with matching folders for watchOS, tvOS and visionOS. The first time you connect a device running a given OS version, Xcode copies that version's system symbols so it can debug on the device and symbolicate crash logs. Every OS update on every device adds another folder, each of them several GB, and Xcode never removes the old ones.
Open the folder in Finder and move the versions you no longer run to the Trash. The folder names include the OS version and build number, so it is easy to see which are old.
What it costs: if you connect a device on a version you removed, Xcode copies the symbols again, which takes a few minutes. Keep the versions your current devices run.
Simulator devices and caches
Path: ~/Library/Developer/CoreSimulator/Devices. Each simulator is a folder holding a full set of data for that device: installed apps, their documents, photos and settings. After you update Xcode, simulators that belonged to runtimes you no longer have are left behind as unavailable devices. The command below removes only those.
To reset the simulators you keep, xcrun simctl erase all wipes the content and settings of every simulator but leaves the devices in place. What it costs: any apps and test data inside those simulators.
~/Library/Developer/CoreSimulator/Caches holds caches the Simulator builds for each runtime. It is safe to delete while the Simulator is closed. What it costs: the next boot of each simulator is slower while the cache is rebuilt.
xcrun simctl delete unavailableOld simulator runtimes
A runtime is the simulated operating system itself, such as a particular iOS version. Each one is several GB, and they pile up as you install new Xcode versions. They are stored in the system-wide /Library/Developer/CoreSimulator, not in your home folder, and should be removed through Xcode or simctl, not by hand.
In Xcode, open Settings and choose Components (called Platforms in Xcode 15). Select a runtime you no longer test against and delete it. From Terminal, the command below lists installed runtimes with their identifiers, and xcrun simctl runtime delete followed by an identifier removes one.
What it costs: you cannot run simulators for that OS version until you download the runtime again, which is a large download.
xcrun simctl runtime listArchives: think before you delete
Path: ~/Library/Developer/Xcode/Archives. Every time you choose Product, then Archive, Xcode stores the built app together with its debug symbols (dSYM files). Archives are grouped in folders by date.
Manage them from Xcode's Organizer: choose Window, then Organizer, select Archives, right-click an archive and delete it.
What it costs: this is the one item you cannot rebuild exactly. You need an archive's dSYMs to symbolicate crash reports from that build, and the archive itself if you have to export or resubmit it. Keep archives for versions that are still live, and remove old development and test builds.
Swift package caches and previews
Swift Package Manager keeps a shared cache of the repositories it has cloned in ~/Library/Caches/org.swift.swiftpm. The command below, run from inside any package folder, empties it. What it costs: packages are downloaded again on the next resolve.
SwiftUI previews run in their own set of simulators, stored in ~/Library/Developer/Xcode/UserData/Previews. To remove them, run xcrun simctl --set previews delete all. What it costs: the next preview takes longer to appear while Xcode recreates the device.
If you use CocoaPods or Carthage, they have caches of their own outside the Xcode folders.
swift package purge-cacheHow Diskzy handles Xcode leftovers
Diskzy's Clean up tab finds these folders and decides a default for each, with the reason shown. DerivedData is ticked, unless Xcode is open. For DeviceSupport, the two newest versions are kept and older ones are ticked. CoreSimulator Caches are ticked. CoreSimulator Devices are unticked, because they are your simulators and their app data. Archives are listed but unticked, so you keep any you may need to resubmit.
Everything Diskzy removes goes to the Trash, so nothing is gone until you empty it. It is a native Mac app for macOS 15 Sequoia or later, free for 72 hours with everything unlocked, then $9 once for 2 Macs.
Common questions
- Is it safe to delete Xcode DerivedData?
- Yes. It contains only build output, indexes and logs that Xcode regenerates. The next build of each project will take longer because nothing is cached.
- Can I delete the iOS DeviceSupport folder?
- Yes. Xcode copies the symbols again the next time you connect a device running that OS version. It is sensible to keep the versions your current devices use.
- What does xcrun simctl delete unavailable do?
- It removes simulator devices whose runtime is no longer installed, which usually means leftovers from older Xcode versions. Simulators you can still run are not touched.
- Should I delete Xcode archives?
- Only the ones you no longer need. An archive holds the debug symbols used to symbolicate crash reports for that build, so keep archives for versions still in use by your customers.
- Why does Xcode use space again after I clean it?
- DerivedData and simulator caches are rebuilt as soon as you build and run a project. That is expected: the saving comes from removing data for old projects, old OS versions and unused simulators.
Related guides
- DerivedData~/Library/Developer/Xcode/DerivedData
- iOS DeviceSupport~/Library/Developer/Xcode/iOS DeviceSupport
- CoreSimulator Devices~/Library/Developer/CoreSimulator/Devices
- CoreSimulator Caches~/Library/Developer/CoreSimulator/Caches
- Xcode Archives~/Library/Developer/Xcode/Archives
Uninstall guides
See where your Mac's space went
Diskzy maps your disk, explains System Data and clears what's safe. Free for 72 hours, then $9 once for 2 Macs.
Try Diskzy for free