Xcode is one of the heaviest disk users on any Mac. The fastest reclaim is deleting build artifacts at ~/Library/Developer/Xcode/DerivedData, which Xcode regenerates automatically on the next build. On a Mac used for active development, this folder plus simulators and old device-support files routinely holds 20-80 GB.
TL;DR
- Delete
~/Library/Developer/Xcode/DerivedDatato free build artifacts; Xcode rebuilds them. - Old
iOS DeviceSupportsymbols accumulate per device/OS version and are safe to remove. .xcarchivefiles inArchivescan be huge; keep only releases you may need to resymbolicate.- Unused simulator runtimes and devices are reclaimable with
xcrun simctl delete unavailable. - None of this touches your source code, git history, or signing certificates.
What exactly is taking up the space?
Four locations do most of the damage, all under ~/Library/Developer/Xcode/:
DerivedData/- compiled objects, indexes, and intermediate build files for every project you have opened.iOS DeviceSupport/- debug symbols Xcode copies the first time you attach a device on a given iOS version.watchOS DeviceSupport/andtvOS DeviceSupport/- the same, for other platforms.Archives/- the.xcarchivebundles produced every time you Product > Archive.
Simulator data lives separately at ~/Library/Developer/CoreSimulator/Devices/, which can quietly grow to many gigabytes.
How do I clear DerivedData safely?
Quit Xcode first, then run:
rm -rf ~/Library/Developer/Xcode/DerivedData/*
This is the single safest big win. DerivedData is pure cache: Xcode recreates it on the next build, at the cost of one slower compile while indexes rebuild. You can also clear a single project from inside Xcode with Product > Clean Build Folder (Shift-Cmd-K), but that does not remove the per-project folders for projects you no longer open.
How do I remove old device-support symbols?
These folders hold one subfolder per iOS version you have ever debugged against:
rm -rf ~/Library/Developer/Xcode/iOS\ DeviceSupport/*
It is safe to delete all of them; Xcode re-copies symbols the next time you attach a device on that OS version. If you debug on an old device daily, that first reconnect will take a minute or two longer.
What about archives and simulators?
Archives are not cache. Each .xcarchive contains the dSYMs you need to symbolicate crash reports for a shipped build, so delete selectively in ~/Library/Developer/Xcode/Archives/. Keep archives for App Store builds still in the wild; remove dead test archives.
For simulators, prune devices and runtimes you no longer target:
xcrun simctl delete unavailable
xcrun simctl shutdown all
To see what runtimes are installed, run xcrun simctl list runtimes. Old runtimes can be removed in Xcode under Settings > Components (or Platforms on newer versions).
What does macOS do natively, and where does it stop?
macOS Storage management (Apple menu > System Settings > General > Storage) shows a large "Developer" category and will let you delete some caches, but it is deliberately coarse: it does not break DerivedData out by project, it leaves DeviceSupport untouched, and it will not prune individual simulator devices. It also will not tell you which .xcarchive belongs to a live App Store build versus a throwaway. The native tool is fine for a rough sweep; the per-folder commands above are how you get the real space back.
What this cannot do, and what to leave alone
Clearing these caches does not speed up your app or fix build errors beyond resolving stale-index glitches. Do not delete ~/Library/MobileDevice/Provisioning Profiles or your login keychain - those hold signing assets that are annoying to regenerate. Leave ~/Library/Developer/Xcode/UserData alone too; it stores your breakpoints, snippets, and key bindings. If you want to find what else is large on the volume, a visual scan helps - the same approach as TreeSize on Windows using a Mac equivalent.
FAQ
Is it safe to delete DerivedData?
Yes. DerivedData contains only build artifacts and indexes that Xcode regenerates automatically. The only cost is a slower first build while indexing completes. Quit Xcode before deleting to avoid file-in-use errors.
Will clearing these caches delete my code or projects?
No. Your source files, git repositories, signing certificates, and provisioning profiles live elsewhere and are untouched. Only build output, debug symbols, and simulator state are removed, and all of those rebuild on demand.
How much space can I actually reclaim?
It varies, but 20-80 GB is common on an active development Mac. DerivedData and simulator devices are usually the largest contributors, followed by accumulated DeviceSupport folders and old archives.
On your phone, Cleanor handles this kind of cleanup automatically - see Cleanor for iPhone.