1. What is Xcode DerivedData?
When building apps in Xcode for iOS, macOS, watchOS, or visionOS, the build system creates intermediate object files, precompiled headers, module cache indices, and build logs in:
When you edit a single Swift file, Xcode reuses existing object artifacts for fast incremental builds. However, Xcode never deletes old build directories for branches you have merged, renamed, or deleted. Over months of active development, this directory balloons uncontrollably.
2. Why Xcode Storage Grows Uncontrollably
Beyond DerivedData, Xcode maintains several other large cache directories that standard macOS uninstaller tools miss:
- Archives (
~/Library/Developer/Xcode/Archives): Every release or TestFlight build creates a bundle with full dSYM debugging symbols (often 1–5 GB each). - iOS DeviceSupport (
~/Library/Developer/Xcode/iOS DeviceSupport): Symbols from every connected physical iPhone and iPad running different iOS versions. - CoreSimulator Devices (
~/Library/Developer/CoreSimulator/Devices): Virtual disk images for each simulator runtime. - Swift Package Manager Caches (
~/Library/Caches/org.swift.swiftpm): Cloned git repositories and compiled dependencies.
3. Safe Terminal Cleanup Commands
You can manually purge these caches using the macOS Terminal. Make sure Xcode is closed before running these commands:
4. Safely Managing Xcode Archives
Archives cannot simply be wiped wholesale if you need dSYMs to symbolicate historical production crash reports. Instead, inspect your archives in Xcode via Window > Organizer or use CleanYourMac Space to filter archives by creation date and project identifier.
Automate with CleanYourMac Space
CleanYourMac Space provides a dedicated Developer Storage Mode that automatically classifies DerivedData by last-accessed date, groups iOS Simulators by runtime, and safely stages all deletions with 100% Trash-first rollback safety.