How to Clean Xcode DerivedData, iOS Simulators & SwiftPM Caches Safely
A typical Xcode installation silently consumes 60–180 GB of hidden disk space outside /Applications/Xcode.app. To reclaim space immediately without losing source code or release dSYMs, purge ~/Library/Developer/Xcode/DerivedData, run xcrun simctl delete unavailable, prune old iOS DeviceSupport symbol tables, and clear ~/Library/Caches/org.swift.swiftpm. Or use StorageSage's Developer Clean Engine to inspect all 14+ developer ecosystems in 0.14 seconds with active Git branch protection.
Complete Xcode Storage Directory Map
| Artifact Category | Path | Typical Size | Deletion Impact |
|---|---|---|---|
| DerivedData & ModuleCache | ~/Library/Developer/Xcode/DerivedData | 20 GB – 95 GB | Safe to delete anytime. Xcode regenerates build artifacts on your next Cmd+B. |
| CoreSimulator Devices | ~/Library/Developer/CoreSimulator/Devices | 15 GB – 85 GB | Safe to delete unavailable devices; active simulator app data will be reset if all devices are wiped. |
| Simulator Runtimes (Disk Images) | /Library/Developer/CoreSimulator/Volumes | 8 GB – 48 GB (6–8 GB per runtime) | Keep only the iOS/visionOS runtimes you actively test against. |
| iOS / watchOS DeviceSupport | ~/Library/Developer/Xcode/iOS DeviceSupport | 10 GB – 45 GB | Safe to remove old OS symbol folders; Xcode re-extracts symbols if an older device is plugged in. |
| SwiftPM & CocoaPods Caches | ~/Library/Caches/org.swift.swiftpm | 4 GB – 25 GB | Safe to delete; Swift Package Manager re-clones git repositories on next package resolution. |
| Xcode Archives (.xcarchive) | ~/Library/Developer/Xcode/Archives | 10 GB – 70 GB | Review first! Contains App Store release builds and dSYMs needed for crash symbolication. |
Exact Terminal Commands for Xcode & Swift Cleanup
1. Wipe DerivedData & Precompiled Clang/Swift Module Caches
Clearing DerivedData also fixes corrupted indexing, SourceKit crashes, and phantom build errors after switching Git branches:
du -sh ~/Library/Developer/Xcode/DerivedData rm -rf ~/Library/Developer/Xcode/DerivedData/*
2. Clean CoreSimulator Devices & Unused Simulator Runtimes
Every Xcode update leaves behind orphaned Simulator devices and 7 GB disk images for older iOS point releases:
# Delete simulator devices tied to runtimes no longer installed xcrun simctl delete unavailable # List all installed Simulator Runtime images and their disk usage xcrun simctl runtime list # Delete simulator caches rm -rf ~/Library/Developer/CoreSimulator/Caches/*
3. Prune Swift Package Manager, CocoaPods & Local .build Folders
SwiftPM stores bare Git clones of every dependency inside ~/Library/Caches/org.swift.swiftpm:
rm -rf ~/Library/Caches/org.swift.swiftpm rm -rf ~/Library/org.swift.swiftpm/security/fingerprints rm -rf ~/Library/Caches/CocoaPods
Why StorageSage's Developer Clean Engine Beats Shell Scripts
Blindly running find ~ -name ".build" -exec rm -rf can wipe build artifacts in a repository you are actively debugging right now. StorageSage's multi-core DeveloperCleanEngine inspects your repositories in 0.14 seconds, deduplicates APFS clone inodes via (st_dev, st_ino), and checks each repo's active Git branch and recency before recommending cleanup.