DerivedData is where Xcode keeps everything it builds: compiled objects, indexes, logs and SwiftUI previews. Each project gets its own folder, and none of them are removed when you stop working on a project. On a Mac that builds a few apps it easily grows past 10 GB, and it shows up in macOS storage settings as "Developer" or "System Data".
Where DerivedData is
By default in ~/Library/Developer/Xcode/DerivedData, one folder per project with a hash after its name. Xcode shows the location under Settings, Locations. To see how big it is:
du -sh ~/Library/Developer/Xcode/DerivedData# per project, biggest lastdu -sh ~/Library/Developer/Xcode/DerivedData/* | sort -h
Is it safe to delete?
Yes. Everything in DerivedData is rebuilt by Xcode. The price is one slower build per project and a re-index. Quit Xcode first, and don't do it while a build runs: deleting files a build is writing to gives you errors that make no sense.
How to delete DerivedData
Everything at once, with Xcode closed:
rm -rf ~/Library/Developer/Xcode/DerivedData/*
Or only one project: delete its folder in Finder, or in Xcode choose Product, Clean Build Folder (Shift-Command-K) with the project open. Clean Build Folder only empties the build products of that project; the index stays.
The rest of what Xcode keeps
DerivedData is usually not the biggest one. These are the other places, from big to small:
Simulator runtimes
Every iOS, watchOS or visionOS runtime you download is several GB. List them and remove the ones you no longer test on, or do the same under Xcode Settings, Components:
xcrun simctl runtime listxcrun simctl runtime delete <identifier># simulators whose runtime is gonexcrun simctl delete unavailable
Device support
~/Library/Developer/Xcode/iOS DeviceSupport holds debug symbols for every iOS version a connected device ever ran, a few GB each. Keep the versions your devices run now; Xcode copies them again when a device needs them.
Archives
~/Library/Developer/Xcode/Archives holds every build you archived for release. Delete old ones in the Organizer, but keep the archives of builds that are live: you need their symbols to read crash reports.
Caches and previews
du -sh ~/Library/Caches/com.apple.dt.Xcodedu -sh ~/Library/Developer/Xcode/UserData/Previews
Both are rebuilt on demand and safe to delete with Xcode closed.
Or let Sluice do it
Sluice removes DerivedData of projects you haven't built for a week, simulator runtimes you haven't opened in months, device support for iOS versions your devices no longer run, and old archives while keeping the newest three per app. It never does that while xcodebuild runs. Sluice is free to download and clean with; Pro cleans every night and whenever space runs low.
macOS 14 Sonoma or later · Apple silicon and Intel · or brew install --cask qraft/tap/sluice
More guides
- "No space left on device" on a Mac: find what filled it and fix it
- How to clear the Gradle cache on a Mac, and what is safe to delete
- Find and delete node_modules (and target, .venv, Pods) across all your projects
- A DevCleaner alternative for Macs that run more than Xcode
- A CleanMyMac alternative for developers