Why Xcode Uses So Much Space

If you have ever opened System Settings on your Mac, navigated to General > Storage, and wondered why "Developer" or "Other" is consuming 80, 100, or even 150 gigabytes, you are not imagining things. Xcode is almost certainly the culprit.

Xcode itself (the application bundle in /Applications/Xcode.app) weighs in at roughly 12-15GB after you download it from the App Store or Apple's developer portal. But the real storage cost is not the app. It is everything Xcode creates, downloads, and caches while you work. Build artifacts, debug symbols for every iOS version you have ever connected a device running, simulator runtimes for every iPhone and iPad model, archived builds from every release you have ever shipped, Swift Package Manager dependency caches, and SwiftUI preview artifacts all accumulate across scattered directories in ~/Library/Developer/.

The problem is compounded by the fact that Xcode never cleans up after itself. When you update from iOS 17 to iOS 18, the old device support files stay behind. When you delete a project, the DerivedData for that project remains. When a simulator runtime becomes unavailable, the cached files persist.

Over the course of a year of active iOS development, it is entirely normal for Xcode-related files to consume 80-160GB or more. On a 256GB MacBook Pro, that is more than half of your total storage.

This guide will walk you through every directory, explain what each one contains, give you the exact terminal commands to clean it, and tell you honestly what is safe to delete and what is not. By the end, you should be able to reclaim anywhere from 50 to 100 gigabytes.

Before You Start: Check Your Current Usage

Before you delete anything, take a snapshot of your current disk usage so you can measure the results. Open Terminal and run:

# Overall disk usage
df -h /

# Total size of the Developer directory
du -sh ~/Library/Developer/

# Breakdown of top-level subdirectories
du -sh ~/Library/Developer/Xcode/*
du -sh ~/Library/Developer/CoreSimulator/
du -sh ~/Library/Caches/org.swift.swiftpm/ 2>/dev/null

On a Mac that has been used for active iOS development for a year or more, you will typically see output along these lines:

$ du -sh ~/Library/Developer/Xcode/*
 32G    /Users/you/Library/Developer/Xcode/DerivedData
 14G    /Users/you/Library/Developer/Xcode/Archives
 18G    /Users/you/Library/Developer/Xcode/iOS DeviceSupport
2.1G    /Users/you/Library/Developer/Xcode/UserData
1.4G    /Users/you/Library/Developer/Xcode/watchOS DeviceSupport

$ du -sh ~/Library/Developer/CoreSimulator/
 48G    /Users/you/Library/Developer/CoreSimulator/

Write down or screenshot these numbers. You will want to compare them after the cleanup.

DerivedData (10-50GB)

What It Is

DerivedData is Xcode's build cache. Every time you build an app, Xcode compiles your Swift and Objective-C source files into object files, links them into executables, processes your asset catalogs, compiles your storyboards and XIBs, and copies the results into a structured output directory. All of this lives inside DerivedData.

Beyond build products, DerivedData also stores the SourceKit index (which powers code completion, jump-to-definition, and Find in Project), build logs, and module caches for the Swift compiler.

Location

~/Library/Developer/Xcode/DerivedData/

Typical Size

A single project's DerivedData folder can range from 500MB for a small app to 5-10GB for a large project with many targets and dependencies. If you work on multiple projects, the combined size easily reaches 10-50GB.

How to Clean It

To delete all DerivedData at once:

# Delete everything inside DerivedData
rm -rf ~/Library/Developer/Xcode/DerivedData/*

To delete DerivedData for a specific project only:

# List all project DerivedData folders with sizes
du -sh ~/Library/Developer/Xcode/DerivedData/* | sort -hr

# Delete a specific project's data (folder name starts with the project name)
rm -rf ~/Library/Developer/Xcode/DerivedData/MyApp-abcdef1234567890/

You can also identify which project a DerivedData folder belongs to by reading its info.plist:

# Show the workspace path for a DerivedData folder
plutil -p ~/Library/Developer/Xcode/DerivedData/MyApp-abcdef1234567890/info.plist

This prints a dictionary that includes the key WorkspacePath, which tells you the exact .xcodeproj or .xcworkspace that generated this folder.

Safety: SAFE. Deleting DerivedData is completely safe. Xcode rebuilds everything the next time you open a project and hit Build. The only downside is that your first build after deletion will be a full (non-incremental) build, which takes longer.

Archives (5-20GB)

What It Is

Every time you run Product > Archive in Xcode, the resulting .xcarchive bundle is saved to the Archives directory. These archives contain the compiled app binary, the dSYM debug symbol files (needed for crash log symbolication), the Info.plist, and the signing entitlements. They are organized by date in year/month/day subfolders.

Location

~/Library/Developer/Xcode/Archives/

Typical Size

Each archive is typically 200MB-2GB depending on the size of your app and whether bitcode is included. If you have been archiving regularly for multiple apps over the years, this directory can easily reach 5-20GB.

How to Clean It

# See total size
du -sh ~/Library/Developer/Xcode/Archives/

# List archives by year
ls -la ~/Library/Developer/Xcode/Archives/

# Delete all archives older than 2025
rm -rf ~/Library/Developer/Xcode/Archives/2023*
rm -rf ~/Library/Developer/Xcode/Archives/2024*

# Or delete everything (you can always re-archive from your git tags)
rm -rf ~/Library/Developer/Xcode/Archives/*

You can also manage archives through Xcode's Organizer window (Window > Organizer > Archives tab), where you can right-click individual archives and choose Delete.

Safety: MODERATE CAUTION. Archives contain your dSYM files, which you need to symbolicate crash reports from App Store releases. Before deleting an archive, make sure you have uploaded the dSYM files to your crash reporting service (Firebase Crashlytics, Sentry, etc.) or that Apple has them via the App Store. If you use Xcode's automatic symbol upload, you are generally safe. For apps still in active support, keep at minimum the archive for the currently released version.

iOS Device Support (10-30GB)

What It Is

Every time you connect a physical iPhone or iPad to your Mac and Xcode prepares it for development, Xcode downloads and caches the debug symbol files for the specific iOS version running on that device. These symbols are needed so that Xcode can attach the debugger, set breakpoints, and symbolicate crash logs from the device.

Location

~/Library/Developer/Xcode/iOS DeviceSupport/

There are also parallel directories for watchOS and tvOS:

~/Library/Developer/Xcode/watchOS DeviceSupport/
~/Library/Developer/Xcode/tvOS DeviceSupport/

Typical Size

Each iOS version's symbols are 2-5GB. If you have connected devices running iOS 15, 16, 17, and 18 at various point releases, you can easily accumulate 10-30GB here.

# Check what you have
du -sh ~/Library/Developer/Xcode/iOS\ DeviceSupport/*

A typical listing looks like:

3.2G    .../iOS DeviceSupport/15.5 (19F77)
3.8G    .../iOS DeviceSupport/16.0 (20A362)
4.1G    .../iOS DeviceSupport/16.4.1 (20E252)
3.9G    .../iOS DeviceSupport/17.0 (21A329)
4.3G    .../iOS DeviceSupport/17.5 (21F79)
4.5G    .../iOS DeviceSupport/18.0 (22A3354)
4.7G    .../iOS DeviceSupport/18.2 (22C152)

How to Clean It

# Delete all device support files (Xcode re-downloads when you connect a device)
rm -rf ~/Library/Developer/Xcode/iOS\ DeviceSupport/*

# Or delete only old versions, keeping the latest
# Keep 18.x, delete everything else
find ~/Library/Developer/Xcode/iOS\ DeviceSupport/ -maxdepth 1 -type d -name "15*" -exec rm -rf {} +
find ~/Library/Developer/Xcode/iOS\ DeviceSupport/ -maxdepth 1 -type d -name "16*" -exec rm -rf {} +
find ~/Library/Developer/Xcode/iOS\ DeviceSupport/ -maxdepth 1 -type d -name "17*" -exec rm -rf {} +

Safety: SAFE. Xcode automatically re-downloads device support files the next time you connect a physical device running that iOS version. The only inconvenience is a short wait (30 seconds to a few minutes) while Xcode re-prepares the device.

Simulators and Runtimes (20-60GB)

What It Is

Xcode simulators consist of two parts: simulator devices (virtual iPhones and iPads that store their own file systems, app data, and settings) and simulator runtimes (the actual iOS system images that power those devices). The runtimes are the big-ticket items.

Location

# Simulator devices and their data
~/Library/Developer/CoreSimulator/Devices/

# Simulator runtimes (iOS, watchOS, tvOS, visionOS system images)
/Library/Developer/CoreSimulator/Cryptex/        # macOS 14+
~/Library/Developer/CoreSimulator/Volumes/        # older macOS
/Library/Developer/CoreSimulator/Profiles/Runtimes/

Typical Size

Each iOS runtime weighs 8-18GB. A complete set of simulators (two iOS versions, one watchOS, one visionOS) can easily consume 20-60GB. Here is a table of approximate runtime sizes:

Runtime Approximate Size
iOS 18.x8-10GB
iOS 17.x7-9GB
iOS 16.x6-8GB
iOS 15.x6-7GB
watchOS 11.x3-5GB
tvOS 18.x4-6GB
visionOS 2.x10-14GB

How to Clean It

# List all simulator runtimes
xcrun simctl runtime list

# List all simulator devices
xcrun simctl list devices

# Delete all "unavailable" simulators (devices for runtimes no longer installed)
xcrun simctl delete unavailable

# Delete a specific runtime
xcrun simctl runtime delete [runtime-identifier]

# Example: delete iOS 16.4 runtime
xcrun simctl runtime delete com.apple.CoreSimulator.SimRuntime.iOS-16-4

# Nuclear option: delete all simulator data and re-create defaults
# WARNING: This deletes all app data inside simulators
rm -rf ~/Library/Developer/CoreSimulator/Devices/*

You can also manage runtimes through the Xcode GUI: go to Xcode > Settings > Platforms (or Components in older Xcode versions) and click the minus button next to runtimes you no longer need.

Safety: MODERATE CAUTION. Deleting simulator runtimes is safe in the sense that Xcode can re-download them, but the download is large (8-18GB per runtime) and can take a long time. Deleting simulator devices wipes any app data, databases, or test state stored inside those simulators. If you rely on specific simulator state for testing, back it up first.

Which Simulators to Keep

A reasonable policy is to keep:

  • The latest iOS runtime (required for current development)
  • One version back (for testing backward compatibility with your minimum deployment target)
  • Any runtime your CI pipeline specifically requires

Everything else can go.

Swift Package Manager Cache

What It Is

When Xcode resolves Swift Package Manager dependencies, it clones the Git repositories into a global cache directory. This avoids re-downloading the same package from GitHub every time you open a different project that depends on it.

Location

~/Library/Caches/org.swift.swiftpm/

There is also a per-project checkout inside each project's DerivedData folder, under SourcePackages/.

Typical Size

Usually 1-5GB, depending on how many packages you use. Projects with heavy dependencies (Firebase, AWS SDK, etc.) can push this higher.

How to Clean It

# Delete the global SPM cache
rm -rf ~/Library/Caches/org.swift.swiftpm/

# Reset package caches from the command line
swift package purge-cache

# In Xcode: File > Packages > Reset Package Caches

Safety: SAFE. Xcode re-downloads all packages the next time you resolve dependencies. The only cost is network time.

SwiftUI Previews Cache

What It Is

When you use SwiftUI Previews in Xcode, the preview engine builds and caches separate preview-specific artifacts for each view. Over time, especially if you use previews across many projects, this cache grows.

Location

~/Library/Developer/Xcode/UserData/Previews/

Typical Size

Ranges from 500MB to 5GB depending on how heavily you use Previews.

How to Clean It

# Delete all preview caches
rm -rf ~/Library/Developer/Xcode/UserData/Previews/*

Safety: SAFE. Previews are rebuilt on demand. Deleting this cache just means the next preview render will take a moment longer.

Documentation Cache and Other Locations

A few more locations worth checking:

Xcode's Documentation Cache

# Documentation downloaded for offline use
~/Library/Developer/Shared/Documentation/

# Check size
du -sh ~/Library/Developer/Shared/Documentation/ 2>/dev/null

This is usually small (under 1GB) but can grow if you have downloaded documentation for multiple platform versions.

Old Build Logs

# Logs from past build sessions
~/Library/Developer/Xcode/DerivedData/*/Logs/

# These are deleted when you clean DerivedData, but you can target them specifically
find ~/Library/Developer/Xcode/DerivedData/ -path "*/Logs/*" -type f -mtime +30 -delete

Module Cache (Clang/Swift)

# Clang module cache
~/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/

# This is also cleaned when you clear DerivedData
rm -rf ~/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/

Old Xcode Versions

What to Look For

If you have ever installed multiple versions of Xcode (common for testing against beta SDKs), you may have old versions sitting in /Applications/:

# Check for multiple Xcode installations
ls -la /Applications/Xcode*

# Check their sizes
du -sh /Applications/Xcode*.app

Each Xcode version is 12-15GB. If you have Xcode 15 and Xcode 16 both installed, that is 25-30GB just for the application bundles.

How to Clean

# Move old Xcode versions to trash (use Finder or)
sudo rm -rf /Applications/Xcode_15.4.app

# After removing, clear the related caches
# (command-line tools still link to the old path)
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

Safety: MODERATE CAUTION. Make sure you keep at minimum the version of Xcode you need for your current projects. Check your project's minimum Xcode version requirement before deleting. Do not delete your primary Xcode installation.

The Safety Guide: What to Delete and What to Keep

Here is a consolidated safety reference table:

Directory Typical Size Safe to Delete? Consequence
DerivedData/ 10-50GB Yes, always safe Next build is full (non-incremental)
Archives/ 5-20GB Yes, with caution Lose dSYMs; keep latest release archive
iOS DeviceSupport/ 10-30GB Yes, always safe Re-downloads when device connects
CoreSimulator/Devices/ 5-15GB Yes, generally safe Lose simulator app data
Simulator Runtimes 20-60GB Yes, remove old ones Must re-download to use again (large download)
org.swift.swiftpm/ 1-5GB Yes, always safe Re-downloads packages on next resolve
Previews/ 0.5-5GB Yes, always safe Next preview render takes longer
Old Xcode versions 12-15GB each Yes, if unused Cannot build with that SDK version

Before and After: Real Storage Savings

Here is a real example from a MacBook Pro that has been used for full-time iOS development for 18 months. The developer works on three apps, tests on physical devices running iOS 17 and 18, and has simulators for iOS 16, 17, and 18.

Directory Before After Saved
DerivedData 38.2GB 0GB 38.2GB
Archives 12.4GB 1.8GB (kept latest) 10.6GB
iOS DeviceSupport 22.1GB 4.5GB (kept iOS 18) 17.6GB
Simulators/Runtimes 42.8GB 16.2GB (kept iOS 17+18) 26.6GB
SPM Cache 3.4GB 0GB 3.4GB
Previews 2.1GB 0GB 2.1GB
Total 121.0GB 22.5GB 98.5GB

That is 98.5GB reclaimed on a 512GB drive, going from 89% full to 69% full. On a 256GB MacBook, this would be the difference between a barely usable machine and one with room to breathe.

The "Just DerivedData" Quick Win

If you are in a hurry and want maximum impact with minimum effort, just clean DerivedData and Device Support. A single command reclaims the most space with zero risk:

# Quick win: typically saves 20-80GB
rm -rf ~/Library/Developer/Xcode/DerivedData/*
rm -rf ~/Library/Developer/Xcode/iOS\ DeviceSupport/*

Automate Everything with DiskPort

The commands above work, but they require you to remember them, open Terminal, and run them periodically. If you forget for a few months, you are right back where you started.

That is exactly the problem DiskPort was built to solve. DiskPort is a native macOS app that:

  • Visualizes every Xcode storage directory in a clean, interactive treemap so you can see exactly what is consuming space
  • Safely cleans DerivedData, Archives, Device Support, Simulators, and SPM caches with intelligent rules (for example, keeping archives for your currently released apps)
  • Relocates large directories to external drives using symlinks, so you keep the data accessible without it eating your internal SSD
  • Monitors your Xcode storage usage over time and alerts you when a threshold is reached
  • Schedules automatic cleanup on whatever interval you choose

Instead of remembering six different rm -rf commands and checking sizes manually, you do it all from a single window. One click to scan. One click to clean. Zero risk of accidentally deleting something you need.