Bottom Line: Apple Xcode is the single largest consumer of hidden disk space on macOS. Every time you build a Swift app, test an iOS simulator, run unit tests, or archive a release build for TestFlight, Xcode writes multi-gigabyte build index files, simulator runtime disks, and symbol packages to your ~/Library directory. Reclaiming 20 GB to 100 GB+ of Xcode developer bloat takes less than 2 minutes using Terminal.
The Anatomy of Xcode Storage Bloat
Software engineers developing iOS, iPadOS, watchOS, macOS, Flutter, or React Native applications face constant disk space pressure. A fresh installation of Xcode consumes 15 GB, but after 6 months of daily app development, Xcode’s supporting caches expand to over 100 GB on your Mac’s internal SSD.
Xcode distributes its storage consumption across 6 distinct directories inside ~/Library/Developer and ~/Library/Caches:
+-------------------------------------------------------------------------+
| [macOS System: 25GB] [User Files: 40GB] [Xcode Caches & Simulators: 95GB]|
+-------------------------------------------------------------------------+
^
Massive Developer Storage Bloat!
Deep Breakdown of the 6 Core Xcode Storage Targets
1. Xcode DerivedData (~/Library/Developer/Xcode/DerivedData) — 15 GB to 60 GB
DerivedData contains build indexes, pre-compiled ModuleCache binaries, intermediate object files, index databases, and unit test logs for every project you open in Xcode.
- Why it grows: Xcode creates a unique subfolder inside
DerivedDatafor every branch and project. Even after closing or deleting a project repository, itsDerivedDatacache remains on disk forever. - Safety Verdict: ✅ 100% Safe to Delete. Xcode will automatically rebuild
DerivedDatawhen you reopen your project and pressCmd + B.
2. iOS Simulator Runtimes & Devices (~/Library/Developer/CoreSimulator) — 15 GB to 50 GB
Every iOS simulator instance (iPhone 14, iPhone 15 Pro, iPad Air) creates a virtual APFS disk image containing installed app binaries, temporary container storage, and WebKit caches. Furthermore, when upgrading Xcode, older iOS simulator runtime images (e.g. iOS 16.2, iOS 17.0) remain stored on disk.
3. Xcode Archives (~/Library/Developer/Xcode/Archives) — 10 GB to 40 GB
Whenever you create an App Store or TestFlight release build (Product > Archive), Xcode saves a complete binary archive bundle (.xcarchive). These archives contain compiled application dSYMs and debug symbol trees.
4. iOS DeviceSupport Symbols (~/Library/Developer/Xcode/iOS DeviceSupport) — 10 GB to 30 GB
When you connect a physical iPhone, iPad, or Apple Watch to your Mac for hardware debugging, Xcode extracts debugging symbol files for that specific iOS version and saves them locally.
5. CocoaPods Master Specs & Cache (~/.cocoapods) — 5 GB to 15 GB
CocoaPods clones the entire GitHub podspec repository locally, consuming gigabytes of small git files and cached tarballs.
6. Swift Package Manager & Carthage Build Caches — 5 GB to 15 GB
Swift Package Manager (SPM) caches cloned git repositories inside ~/Library/Caches/org.swift.swiftpm.
Master Terminal Cleanup Script for Xcode Developers
Copy and paste these commands into Terminal to reclaim maximum developer storage:
#!/usr/bin/env bash
echo "🚀 Starting Xcode & iOS Developer Cleanup..."
# 1. Clear Xcode DerivedData
echo "🧹 Purging DerivedData..."
rm -rf ~/Library/Developer/Xcode/DerivedData/*
# 2. Delete Unavailable Simulator Instances
echo "🧹 Purging unavailable iOS simulators..."
xcrun simctl delete unavailable
# 3. Clear Simulator Caches
echo "🧹 Clearing Simulator caches..."
rm -rf ~/Library/Developer/CoreSimulator/Caches/*
# 4. Clear Xcode Archives
echo "🧹 Purging archived app bundles..."
rm -rf ~/Library/Developer/Xcode/Archives/*
# 5. Clear iOS DeviceSupport Symbols
echo "🧹 Purging old iOS DeviceSupport symbols..."
rm -rf ~/Library/Developer/Xcode/iOS\ DeviceSupport/*
# 6. Clear Swift Package Manager Cache
echo "🧹 Purging SPM Cache..."
rm -rf ~/Library/Caches/org.swift.swiftpm/*
# 7. Clear CocoaPods Cache
if command -v pod &> /dev/null; then
echo "🧹 Purging CocoaPods cache..."
pod cache clean --all &> /dev/null
rm -rf ~/.cocoapods/repos/trunk
fi
echo "🎉 Xcode Cleanup Complete! Current Disk Space:"
df -h /
How to Relocate Xcode DerivedData to an External SSD
If your Mac has a small 256GB internal SSD, you can redirect Xcode’s DerivedData directory to an external NVMe SSD:
- Connect your fast external SSD (e.g., Samsung T7 or SanDisk Extreme).
- Open Xcode > Settings (Cmd + ,) > Locations.
- Next to Derived Data, select Advanced.
- Set the path to your external SSD folder.
Xcode Storage Impact & Safety Matrix
| Path / Folder | Typical Size | Safety Rating | Re-creation Behavior |
|---|---|---|---|
Xcode/DerivedData |
15 GB – 60 GB | ✅ 100% Safe | Xcode rebuilds indexes on next compile. |
simctl delete unavailable |
15 GB – 50 GB | ✅ 100% Safe | Removes stale virtual devices. |
Xcode/Archives |
10 GB – 40 GB | ⚠️ Use Caution | Removes historical TestFlight archives. |
iOS DeviceSupport |
10 GB – 30 GB | ✅ 100% Safe | Extracted dynamically when debugging. |
org.swift.swiftpm |
5 GB – 15 GB | ✅ 100% Safe | Cloned on swift build or Xcode resolve. |
Frequently Asked Questions (FAQ)
Will clearing DerivedData break my active Xcode projects?
No. DerivedData contains zero source code. It only contains cached build outputs and symbol index trees. Your .swift code files and .xcodeproj project settings remain 100% untouched.
How do I delete old iOS Simulator runtime installers?
Open Terminal and run xcrun simctl runtime list to view installed runtimes, then use sudo xcrun simctl runtime delete <runtime-identifier> to remove old iOS runtime packages.
Related iOS Developer Guides
- Step-by-step guide to cleaning Xcode DerivedData.
- Learn about Xcode CoreSimulator Virtual Disks.
Discussion
Loading authentication...