Developer Tools • 6 min read • September 2026

How to Safely Delete Xcode DerivedData & Build Caches

Clear 30GB–80GB of stale build artifacts, module indexes, and simulator archives on macOS without breaking your projects.

Why Does Xcode Consume So Much Storage?

Apple's Xcode is notorious for consuming immense storage. On active iOS and macOS developer machines, Xcode often hogs over 100 GB of internal storage. The primary culprit is ~/Library/Developer/Xcode/DerivedData.

DerivedData stores intermediate build objects, precompiled headers, SymbolGraph files, and SourceKit indexing databases. Over months of building and testing, Xcode never cleans up old builds for deleted branches or previous SDK targets.

Manual Terminal Commands to Purge DerivedData

Close Xcode completely before running these commands to prevent indexing lockups:

# Quit Xcode completely
killall Xcode 2>/dev/null

# Purge all DerivedData caches
rm -rf ~/Library/Developer/Xcode/DerivedData/*

# Purge old iOS DeviceSupport symbols (often 20GB+)
rm -rf ~/Library/Developer/Xcode/iOS\ DeviceSupport/*

# Purge old build Archives
rm -rf ~/Library/Developer/Xcode/Archives/*

Will this delete my project code? No. DerivedData only contains build outputs. The next time you open a project, Xcode will recompile and rebuild clean artifacts.

⚡ Developer Hygiene

Automate Xcode Cleanup with XrayMac

XrayMac identifies obsolete DerivedData packages, CocoaPods caches, Swift Package Manager artifacts, and orphan device symbols, allowing you to reclaim 40GB+ in a single click without touching active branch indexes.

Frequently Asked Questions

Does deleting DerivedData slow down my next build?

The very first build after clearing DerivedData will take longer because Xcode must rebuild dependencies. However, subsequent incremental builds will run faster due to cleaner compiler caches.

Can I move DerivedData to an external SSD?

Yes, via Xcode Settings > Locations > Derived Data > Advanced. However, an external drive can degrade compilation speeds compared to the internal Apple Silicon NVMe.

How often should I clean DerivedData?

Once a month, or whenever you encounter unexplainable compiler errors, broken Swift autocomplete, or strange build conflicts.

XrayMac

XrayMac Engineering Team

Pure Swift 6 & APFS storage diagnostics for macOS Sonoma & Sequoia.