← All articles

16 June 2026

How to Delete Xcode Cache and Free Up Space on a Mac

Xcode quietly eats tens of gigabytes. Here is what each cache is — DerivedData, iOS DeviceSupport, simulators, archives — what is safe to delete, and the commands to reclaim the space.

If your Mac's storage keeps filling up and you do iOS or macOS development, the culprit is almost always Xcode. It quietly accumulates build artefacts, device symbols, simulator runtimes, and caches that can swell to tens of gigabytes—often more than the apps you are actually building. The good news is that most of it is safe to delete and regenerates on demand. The trick is knowing which folders are throwaway and which one deserves a second thought before you reach for rm -rf.

Nearly all of Xcode's bulk lives under one hidden directory: ~/Library/Developer. Before you start, quit Xcode so it is not rewriting files while you delete them. Then work through the areas below, biggest and safest first.

DerivedData — the big, safe win

DerivedData holds intermediate build files, indexes, and logs for every project you have ever opened. It is the single largest and safest thing to clear—Xcode simply rebuilds what it needs next time you open a project. You can empty it from within Xcode via Settings → Locations → Derived Data (click the small arrow to open the folder), or do it straight from Terminal:

  • rm -rf ~/Library/Developer/Xcode/DerivedData/* clears every project's build cache while leaving the folder itself in place.
  • Deleting a single misbehaving project's folder (each is named ProjectName-randomhash) is also a reliable fix for stale-build and indexing glitches, not just a space saver.

iOS DeviceSupport — symbol files you forgot about

Every time you connect a physical device running a new iOS version, Xcode downloads a matching set of debug symbol files. They pile up in ~/Library/Developer/Xcode/iOS DeviceSupport (with watchOS and tvOS equivalents alongside), and old point releases you will never touch again can occupy several gigabytes each. They are safe to delete—Xcode re-downloads the set for a device when you next connect one. Remove the folders for iOS versions you no longer test against and keep the ones you actively support.

Old and unavailable simulators

Simulator runtimes are huge, and Xcode keeps old ones around long after you have moved on. The cleanest way to prune them is with the command-line simulator tool rather than deleting files by hand:

  • xcrun simctl delete unavailable removes every simulator tied to a runtime that is no longer installed—a safe, one-shot tidy-up.
  • xcrun simctl list shows what you have, so you can xcrun simctl delete <UDID> specific devices you do not need.
  • Whole runtime downloads live under ~/Library/Developer/CoreSimulator; you can also manage them in Xcode → Settings → Components (or Platforms).

Archives — the one to treat with care

Every time you archive a build, Xcode stores it in ~/Library/Developer/Xcode/Archives. Unlike the folders above, archives cannot be regenerated—each contains the exact binary and the dSYM files you need to symbolicate crash reports from that release or to re-submit it to the App Store. Do not bulk-delete this folder blindly. Instead, open Window → Organizer → Archives in Xcode and remove only the old builds you are certain you will never need to debug or resubmit. Keep the archive for anything currently live in the store.

Xcode caches and package data

A few more caches round out the cleanup, all safe to remove:

  • ~/Library/Caches/com.apple.dt.Xcode is Xcode's general cache, including the precompiled module cache.
  • ~/Library/Caches/org.swift.swiftpm holds Swift Package Manager's downloaded dependency cache, which can grow surprisingly large.

A quick, safe cleanup sequence

With Xcode closed, this ordered run clears the regenerable bulk without touching your archives:

  • rm -rf ~/Library/Developer/Xcode/DerivedData/*
  • rm -rf ~/Library/Developer/Xcode/iOS\ DeviceSupport/* (delete only the versions you no longer need)
  • xcrun simctl delete unavailable
  • rm -rf ~/Library/Caches/com.apple.dt.Xcode/*

If you would rather find the offenders before deleting anything, our companion guide on finding large hidden files on a Mac shows how to rank the biggest space-hogs—Xcode's folders included—before you touch them. And if it turns out your Mac is sluggish rather than full, a stale DNS cache can masquerade as a storage problem; see our notes on how to flush the DNS cache on macOS. For the authoritative reference on Xcode itself, Apple's Xcode documentation is the place to confirm anything before you delete it.

Takeaway: Reclaim DerivedData, iOS DeviceSupport, old simulators, and Xcode's caches freely—they all rebuild on demand. The one exception is Archives: prune those from the Organizer, deliberately, and only when you are sure you will never need to symbolicate or resubmit that build.