Guides · Xcode

What's in ~/Library/Developer? What's safe to delete, folder by folder

Xcode keeps almost everything it makes in one folder in your home Library, and it rarely cleans up after itself. This is a map of that folder: what each part is, whether you can delete it, and what happens if you do.

Short answerSafe to delete: Xcode/DerivedData, old versions in Xcode/iOS DeviceSupport, Xcode/DocumentationCache, CoreSimulator/Caches and simulators whose runtime is gone. Review one by one: Xcode/Archives. Keep: Xcode/UserData. Quit Xcode first, and move things to the Trash rather than deleting them outright, so a mistake can be put back.

First, measure it

The folder is hidden in Finder by default. To see what each part takes, open Terminal:

du -sh ~/Library/Developer/* | sort -h
du -sh ~/Library/Developer/Xcode/* | sort -h

On the Mac this guide was written on, the big ones were CoreSimulator/Devices at 36 GB and Xcode/iOS DeviceSupport at 19 GB. DerivedData was only 2.6 GB because it had been cleaned recently; on a Mac that builds a few large projects every day, 20 to 60 GB is common.

The map

"Rebuilds" means Xcode or a tool makes it again when needed, at the cost of time or a download. "Review first" means some of it may be the only copy of something you need.

Folder (in ~/Library/Developer)What it isDelete it?
Xcode/DerivedDataBuild products, intermediate files, the code index, logs and checked-out Swift packages, one folder per project, plus a shared module cache.Rebuilds. The next build is a full one and Xcode re-indexes. More on DerivedData.
Xcode/ArchivesEvery build you archived for TestFlight or the App Store, with its dSYMs (the symbols that turn crash reports into readable stack traces).Review first. Keep archives for versions people still run. Old betas and test builds can go. Which archives to keep.
Xcode/iOS DeviceSupport (and watchOS, tvOS, visionOS, macOS)Symbols copied from each OS version on a device you connected for debugging, a few GB per version.Old versions: yes. Copied again, which takes a few minutes, if you connect a device on that version. Keep the newest per platform. More on device support.
Xcode/DocumentationCacheDownloaded documentation.Yes. Downloaded again when needed.
Xcode/UserDataYour Xcode settings: key bindings, themes, code snippets, breakpoints.Keep. The exception is UserData/Previews, below.
Xcode/UserData/PreviewsSimulators Xcode creates for SwiftUI previews.Yes, with xcrun simctl --set previews delete all. Recreated on the next preview.
CoreSimulator/DevicesOne folder per simulator, holding its installed apps and their data.Unavailable ones: yes, with xcrun simctl delete unavailable. Others hold app data; erase or delete them only if you don't need it.
CoreSimulator/CachesCaches the simulators build, such as dyld caches.Yes. Rebuilt when a simulator next boots, which makes that boot slower.
XCTestDevicesClones of simulators made for parallel testing.Yes, when no tests are running. Made again by the next parallel test run.
XCPGDevicesSimulators made for Xcode playgrounds.Yes. Usually small.
CoreDevice, DeveloperDiskImagesUsed by Xcode's connection to physical devices.Leave alone unless it is unusually large; then look inside before removing anything.

Outside this folder: three more places Xcode fills

FolderWhat it isDelete it?
/Library/Developer/CoreSimulatorSimulator runtimes, about 8 GB per iOS version. Outside your home folder, so du ~/Library/Developer never counts them.Old ones: yes. See how to delete old simulator runtimes.
~/Library/Caches/com.apple.dt.Xcode, com.apple.dt.xcodebuildXcode's own caches.Yes, with Xcode closed.
~/Library/Caches/org.swift.swiftpm, CocoaPods, org.carthage.CarthageKit, HomebrewPackage managers' download caches.Rebuilds. Packages are downloaded again on the next resolve or install. The command for each.

A safe order to clean

  1. Quit Xcode and Simulator. Moving build data while Xcode writes to it can leave a half-finished build behind.
  2. Remove what can't run anyway: xcrun simctl delete unavailable.
  3. Remove old simulator runtimes you no longer test on. This is usually the biggest single win.
  4. Remove old device support versions, keeping the newest for each platform and any version a test device still runs.
  5. Remove DerivedData for projects you aren't working on this week, or all of it if you don't mind a full rebuild.
  6. Go through Archives by app and version. Keep what's in users' hands.
  7. Empty the Trash when you're sure. Until then the space isn't free, but everything can still be put back.

Use the Trash, not rm -rf

Most guides end with rm -rf, which can't be undone and doesn't care if a path is wrong. Since macOS 15, macOS has a command that moves things to the Trash instead:

trash ~/Library/Developer/Xcode/DerivedData/*

The items land in the Trash, where you can still get them back, and the space returns when you empty it. On macOS 14, drag the folders to the Trash in Finder (Go › Go to Folder, then paste the path).

This whole map, measured for you

DevSweep scans exactly these folders, puts a label on each item (Safe, Rebuilds on next build, Review first), never ticks archives or your newest device support for you, and moves only what you pick to the Trash. Every cleanup is kept in History with Undo. It needs no Full Disk Access.