# How to Safely Clean Xcode Derived Data, Simulators & Runtimes

> Xcode regularly consumes 40–120+ GB across Derived Data, downloaded iOS/watchOS/visionOS Simulator Runtimes (~7 GB each), physical Device Support debug symbols, SwiftUI Preview simulators, and old Archives. Derived Data, Preview simulators, and Xcode caches regenerate automatically; Simulator Runtimes and Device Support can be re-downloaded; Archives contain dSYMs and should be reviewed first.

- **Canonical URL**: https://cruft.app/guides/clean-xcode-derived-data-simulators
- **Category**: Xcode
- **Typical Reclaimable Space**: 25–120 GB
- **Last Updated**: 2026-12-04

## Quick Facts

- **Typical reclaimable space**: 25–120 GB
- **100% safe to clear**: Derived Data, Previews, XCTestDevices, CoreSimulator Caches, Simulator Logs
- **Review before deleting**: Archives (.xcarchive dSYMs), booted/active Simulators, active Xcode.app
- **CLI tool for runtimes**: xcrun simctl runtime list / delete

## Exact macOS Paths & Safety Reference

| Location | macOS Path | Typical Size | Safety | Rebuild / Effect |
| --- | --- | --- | --- | --- |
| Derived Data | `~/Library/Developer/Xcode/DerivedData` | 10–50 GB | Safe | Rebuilt on next Xcode build; first compile & index take longer. |
| Simulator Runtimes | `Managed disk images (xcrun simctl runtime list)` | 7–40 GB | Re-download | Re-download anytime from Xcode › Settings › Components. |
| Simulator Devices | `~/Library/Developer/CoreSimulator/Devices` | 2–25 GB | Review | Removes installed apps & simulator app data; unavailable devices are safe to prune. |
| Device Support Symbols | `~/Library/Developer/Xcode/{iOS,watchOS,tvOS,visionOS} DeviceSupport` | 3–20 GB | Re-download | Xcode copies symbols again the next time you plug that physical device in. |
| SwiftUI Previews & Test Clones | `~/Library/Developer/Xcode/UserData/Previews & ~/Library/Developer/XCTestDevices` | 1–15 GB | Safe | Xcode recreates hidden preview and parallel test simulators on demand. |
| Archives | `~/Library/Developer/Xcode/Archives` | 2–20 GB | Review | Holds dSYMs needed for crash symbolication — keep builds still in production unless backed up. |
| Xcode, Clang & CoreSimulator Caches | `~/Library/Caches/com.apple.dt.* & ~/Library/Developer/CoreSimulator/Caches` | 2–15 GB | Safe | Rebuilt automatically (quit Xcode first). |
| SwiftPM, CocoaPods & Carthage Caches | `~/Library/Caches/{org.swift.swiftpm,CocoaPods,org.carthage.CarthageKit}` | 1–10 GB | Re-download | Packages re-download on next dependency resolution. |

## 1. Clean Derived Data (without resetting active projects)

Every Xcode project and workspace creates a hashed subfolder inside ~/Library/Developer/Xcode/DerivedData (or your custom IDECustomDerivedDataLocation). Deleting the entire DerivedData directory works, but forces a slow cold rebuild of the app you're actively working on today.

A smarter approach is checking each subfolder's info.plist (WorkspacePath and LastAccessedDate) so you remove only deleted repos and projects idle for 30+ days while keeping your current project's build cache warm.

**List Derived Data folders by size**

```sh
du -sh ~/Library/Developer/Xcode/DerivedData/* 2>/dev/null | sort -hr
```

> Note: Quit Xcode before removing active build folders or shared ModuleCache.noindex / CompilationCache.noindex folders.

## 2. Remove superseded iOS Simulator Runtimes

Modern Xcode installs simulator OS images as mounted APFS disk images (~6–8 GB each). Every Xcode update can leave behind older point-release runtimes (for example iOS 18.1 alongside 18.2, or old watchOS/visionOS runtimes you only downloaded once).

Do not try to delete mounted CoreSimulator runtime images manually in Finder — always remove them through xcrun simctl so CoreSimulator unmounts and unregisters them cleanly.

**List and remove unused simulator runtimes & unavailable simulators**

```sh
xcrun simctl runtime list
xcrun simctl delete unavailable
# Delete a specific unused runtime by its identifier:
# xcrun simctl runtime delete <RUNTIME_IDENTIFIER>
```

> Note: Simulator runtimes deleted via simctl bypass the Trash — check the identifier and last-used date carefully first.

## 3. Reclaim SwiftUI Previews, XCTest clones & old Device Support

SwiftUI Canvas previews spin up their own separate simulator set under ~/Library/Developer/Xcode/UserData/Previews, and parallel test runs populate ~/Library/Developer/XCTestDevices. Both can silently balloon past 10 GB and are completely safe to remove.

Physical device debug symbols in ~/Library/Developer/Xcode/iOS DeviceSupport add ~2–4 GB per iOS version you've ever plugged into your Mac. Keep the newest OS version for your current test device and clear older builds.

**Clear SwiftUI preview simulators safely via simctl**

```sh
xcrun simctl --set previews delete all
```

## 4. Be careful with Xcode Archives and multiple Xcode installs

Each .xcarchive bundle in ~/Library/Developer/Xcode/Archives contains the compiled binary and dSYM symbol files required to symbolicate production crash reports. Only remove older archives if their dSYMs are already uploaded to App Store Connect, Crashlytics, or Sentry.

If you keep beta or older Xcode copies in /Applications, check xcode-select -p before deleting any bundle so you never remove your active command-line toolchain.

## How Cruft Automates This Safely

- Reads every Derived Data info.plist to show real project names (even resolving generic Flutter/React Native “Runner” workspaces), last-used dates, and flags deleted repos as “Project missing”.
- Detects superseded simulator runtimes, orphaned CoreSimulator UUID folders, and archives already uploaded to App Store Connect.
- Locks booted simulators and the active xcode-select installation so you can't delete what's in use.

Download Cruft free to scan (https://updates.cruft.app/Cruft.dmg) or buy a lifetime 3-Mac license for €15 once (https://license.cruft.app/buy).

## Frequently Asked Questions

### Is it safe to delete ~/Library/Developer/Xcode/DerivedData?

Yes. Derived Data only holds generated build intermediates, indexes, and module caches. Xcode recreates everything on the next build, though the first build and indexing pass will take longer.

### Why won't deleting Simulator Runtimes move them to the Trash?

Starting with Xcode 15, Apple manages Simulator Runtimes as cryptographically sealed APFS disk images through CoreSimulator (xcrun simctl runtime delete), which removes them directly rather than moving them to the user Trash.

### Should I delete Xcode Archives?

Review them first. Archives store dSYM files needed to symbolicate crash logs from shipped versions of your app. Keep the latest archive for each active app unless your dSYMs are backed up in App Store Connect or your crash reporter.
