If you're an iOS or macOS developer, you've probably noticed Xcode silently consuming massive amounts of disk space. Between DerivedData, iOS Device Support files, old simulators, and archived builds, Xcode can easily use 30-80GB+ of your Mac's storage.
This guide covers every Xcode-related cache, how much space each typically uses, whether it's safe to delete, and the exact commands to clean it up.
Typical Xcode disk usage on an active developer's Mac
5-50GB
DerivedData is the biggest offender. It contains build products, indexes, and logs for every Xcode project and workspace you've opened.
~/Library/Developer/Xcode/DerivedData/
# Delete all DerivedData
rm -rf ~/Library/Developer/Xcode/DerivedData
# Or delete a specific project's data
rm -rf ~/Library/Developer/Xcode/DerivedData/YourProject-*
# Check size before deleting
du -sh ~/Library/Developer/Xcode/DerivedData
You can also clean from within Xcode: Settings > Locations > DerivedData -- click the arrow to open in Finder.
2-20GB
Every time you connect a physical iOS device, Xcode downloads debug symbols for that device's iOS version. These accumulate over years.
~/Library/Developer/Xcode/iOS DeviceSupport/
Debug symbol files for each iOS version you've ever connected. Each version is 2-4GB. If you've been developing for several years, you might have symbols for iOS 14, 15, 16, 17, and 18.
# See sizes per iOS version
du -sh ~/Library/Developer/Xcode/iOS\ DeviceSupport/*
# Delete all (Xcode will re-download as needed)
rm -rf ~/Library/Developer/Xcode/iOS\ DeviceSupport/*
# Delete only old versions (keep 18.x)
find ~/Library/Developer/Xcode/iOS\ DeviceSupport -maxdepth 1 -name "1[4567]*" -exec rm -rf {} +
1-10GB
~/Library/Developer/Xcode/Archives/
Every time you archive a build for App Store submission or ad-hoc distribution, Xcode saves the full archive (.xcarchive). These include the compiled app, dSYM files, and Info.plist.
# Check total size
du -sh ~/Library/Developer/Xcode/Archives
# Open in Finder to review individually
open ~/Library/Developer/Xcode/Archives
# Or use Xcode Organizer: Window > Organizer > Archives
# Right-click to delete specific archives
5-30GB
Xcode installs simulator runtimes for each iOS version. Each runtime is 5-7GB, and they accumulate if you don't clean up after Xcode updates.
# Simulator runtimes (macOS 14+)
/Library/Developer/CoreSimulator/Volumes/
# Older macOS
~/Library/Developer/CoreSimulator/Profiles/Runtimes/
# List installed simulator runtimes
xcrun simctl runtime list
# Delete unavailable/orphaned simulators
xcrun simctl delete unavailable
# Delete a specific runtime (get the identifier from the list above)
xcrun simctl runtime delete <identifier>
# List all simulators and their sizes
xcrun simctl list devices
You can also manage simulators from Xcode > Settings > Platforms.
1-5GB
~/Library/Caches/com.apple.dt.Xcode/
~/Library/Caches/com.apple.dt.XCTRunner/
rm -rf ~/Library/Caches/com.apple.dt.Xcode
rm -rf ~/Library/Caches/com.apple.dt.XCTRunner
2-15GB
Each simulator device has its own data directory with installed apps, app data, and system files.
~/Library/Developer/CoreSimulator/Devices/
simctl command to cleanly remove unavailable devices.
# Best approach: remove unavailable devices
xcrun simctl delete unavailable
# Erase all simulator content and settings
xcrun simctl erase all
# Check total size
du -sh ~/Library/Developer/CoreSimulator/Devices
1-5GB
If you've installed additional Swift toolchains or have leftover files from old Xcode versions:
# Custom toolchains
~/Library/Developer/Toolchains/
# Command line tools (separate from Xcode)
/Library/Developer/CommandLineTools/
# Remove custom toolchains you no longer use
ls ~/Library/Developer/Toolchains/
# If you're using Xcode, you can safely remove standalone command line tools
# (Xcode includes its own)
sudo rm -rf /Library/Developer/CommandLineTools
1-5GB
SPM caches downloaded package sources and resolved artifacts.
~/Library/Caches/org.swift.swiftpm/
~/Library/org.swift.swiftpm/
# Clean SPM cache
rm -rf ~/Library/Caches/org.swift.swiftpm
rm -rf ~/Library/org.swift.swiftpm
# Or use Swift's built-in command
swift package purge-cache
# Reset package resolution in Xcode
# File > Packages > Reset Package Caches
| Category | Location | Typical Size | Safe to Delete? |
|---|---|---|---|
| DerivedData | ~/Library/Developer/Xcode/DerivedData | 5-50GB | Yes |
| iOS Device Support | ~/Library/Developer/Xcode/iOS DeviceSupport | 2-20GB | Yes (old versions) |
| Archives | ~/Library/Developer/Xcode/Archives | 1-10GB | Keep production |
| Simulator Runtimes | /Library/Developer/CoreSimulator/Volumes | 5-30GB | Yes (old runtimes) |
| Xcode Caches | ~/Library/Caches/com.apple.dt.Xcode | 1-5GB | Yes |
| CoreSimulator Devices | ~/Library/Developer/CoreSimulator/Devices | 2-15GB | Yes (unavailable) |
| Swift Toolchains | ~/Library/Developer/Toolchains | 1-5GB | Yes (unused) |
| SPM Cache | ~/Library/Caches/org.swift.swiftpm | 1-5GB | Yes |
Running these commands manually every week gets tedious. ClearDisk is a free, open-source macOS menu bar app that:
ClearDisk detects DerivedData, Device Support, Simulators, SPM cache, and 15+ other developer caches. Free and open source.
View on GitHubbrew tap bysiber/cleardisk && brew install --cask cleardisk
Grab the latest DMG from GitHub Releases.
If you prefer the terminal approach, here's a script that cleans all Xcode caches in one go:
#!/bin/bash
# Clean all Xcode caches
echo "Cleaning DerivedData..."
rm -rf ~/Library/Developer/Xcode/DerivedData
echo "Cleaning iOS Device Support..."
rm -rf ~/Library/Developer/Xcode/iOS\ DeviceSupport
echo "Cleaning Xcode Cache..."
rm -rf ~/Library/Caches/com.apple.dt.Xcode
echo "Cleaning SPM Cache..."
rm -rf ~/Library/Caches/org.swift.swiftpm
echo "Removing unavailable simulators..."
xcrun simctl delete unavailable
echo "Done! Restart Xcode for best results."