Xcode taking up space? How to clean it up
Xcode is one of the biggest space users on a developer's Mac: build products, simulators, device symbols and archives can add up to well over 50 GB. Here's what each one is and how to clean it safely.
Xcode is one of the biggest space users on a developer's Mac: build products, simulators, device symbols and archives can add up to well over 50 GB. Here's what each one is and how to clean it safely.
~/Library/Developer/Xcode/DerivedData holds intermediate build files and indexes for every project you've opened. It's safe to delete entirely — Xcode rebuilds what it needs the next time you build (the first build is slower).
Quit Xcode first, then delete the folder's contents, or delete just the folders of projects you no longer work on.
xcrun simctl runtime list and xcrun simctl runtime delete followed by the runtime's identifier.~/Library/Developer/CoreSimulator/Devices. xcrun simctl delete unavailable removes devices whose runtime is gone.~/Library/Developer/CoreSimulator/Caches can be deleted; they're rebuilt as needed.Every time you connect a device running a new OS version, Xcode copies its debug symbols to ~/Library/Developer/Xcode/iOS DeviceSupport (and watchOS DeviceSupport, etc.). Each version takes a few gigabytes. Delete folders for versions you no longer debug on; Xcode copies them again if you reconnect such a device.
~/Library/Developer/Xcode/Archives holds every app you've archived for distribution. Keep the archives of builds you've shipped (you need their debug symbols to read crash reports); older internal builds can go. Manage them in Window → Organizer.
DiskGarden shows ~/Library/Developer folder by folder, so you can see at a glance whether simulators, DerivedData or device support is the big one — then drag it into the Waste bin to remove it.
Using other toolchains too? Package caches add up as well: see which caches are safe to delete.
DiskGarden is a free disk space analyzer for Mac: it maps every folder by size, so the space hogs stand out. No account, and your files never leave your Mac.