lysosome

Guide · Xcode

Free up disk space from Xcode: DerivedData, simulators and device support

Updated · Scott Havird

short answer

Quit Xcode and delete ~/Library/Developer/Xcode/DerivedData; the next build recreates it. Then run xcrun simctl delete unavailable to drop simulators whose runtime is gone, delete old folders under ~/Library/Developer/Xcode/iOS DeviceSupport, and remove simulator runtimes you no longer test on. Keep Archives unless you're sure you won't need their crash-report symbols.

What takes the space

WhatWhereSafe to delete?
DerivedData: build products, indexes, logs~/Library/Developer/Xcode/DerivedDataregenerable rebuilt by the next build, which will be slower once
Device support: debug symbols copied from each iPhone, Watch or TV OS version you connected~/Library/Developer/Xcode/iOS DeviceSupport (also watchOS, tvOS, visionOS)regenerable copied again when that device connects
Simulator devices and their data~/Library/Developer/CoreSimulator/Devicesexpensive unavailable ones yes; others lose their installed apps and data
Simulator runtimes (one per iOS version)Managed by xcrun simctl runtimeexpensive re-downloaded from Xcode > Settings > Components
Archives of builds you shipped~/Library/Developer/Xcode/Archivesreview they hold dSYMs you need to symbolicate crash reports

Measure them by hand

du -sh ~/Library/Developer/Xcode/DerivedData
du -sh ~/Library/Developer/Xcode/*DeviceSupport/* 2>/dev/null | sort -h
du -sh ~/Library/Developer/CoreSimulator/Devices
du -sh ~/Library/Developer/Xcode/Archives
xcrun simctl list devices unavailable    # simulators whose runtime is no longer installed
xcrun simctl runtime list                # installed simulator runtimes and their identifiers

Clean it up safely by hand

# DerivedData: quit Xcode first
rm -rf ~/Library/Developer/Xcode/DerivedData

# Device support for an OS version you no longer debug on
rm -rf ~/Library/Developer/Xcode/"iOS DeviceSupport"/"<old version folder>"

# Simulators whose runtime is gone
xcrun simctl delete unavailable

# A simulator runtime you no longer need (identifier from 'xcrun simctl runtime list')
xcrun simctl runtime delete <identifier>

How lysosome does it

lysosome caches --category xcode                             # read-only report
lysosome clean --caches --only 'xcode-*'                      # dry run: DerivedData and device support
lysosome clean --caches --only 'xcode-*' --tier regenerable_expensive
                                                              # also unavailable simulators and runtimes

lysosome reports DerivedData and each device support version as regenerable and moves them to the Trash. Unavailable simulators and deletable runtimes are regenerable_expensive and go through xcrun simctl delete unavailable and xcrun simctl runtime delete, so a plain clean leaves them alone. Runtimes bundled with Xcode and the Archives folder are labeled review and never cleaned. Xcode detection only runs on macOS.

The same scan covers the rest of a dev Mac: dormant agent worktrees, build artifacts, local AI models, Docker and package caches.