Developer storage

Xcode Derived Data: what it is and how to delete it safely

Derived Data is Xcode's per-project scratch directory at ~/Library/Developer/Xcode/DerivedData. It holds build products, indexes and caches, all of which Xcode can regenerate, so deleting it is safe once Xcode is closed. The only cost is a slower first build and a re-index.

Updated 2026-10-27

Key points

  • Derived Data contains build output, indexes and compiler caches — never your source code.
  • Quit Xcode before deleting; removing files while it runs can leave stale indexes and failed builds.
  • Deleting Derived Data makes the next build slower and forces a re-index, but nothing is lost.
  • Archives are different: they hold shipped builds and dSYMs, so delete them only when you no longer need to symbolicate those releases.
  • Simulator runtimes and iOS DeviceSupport are the other large Xcode-related folders on a developer Mac.

Derived Data is Xcode’s scratch directory. It holds everything Xcode generates while building, running and indexing your projects, and nothing that belongs to your source. You can delete it with rm -rf ~/Library/Developer/Xcode/DerivedData/* once Xcode is closed; the next build is slower, but your code, certificates and project settings are untouched.

What Xcode Derived Data actually contains

Every time you build, run, preview or index a project, Xcode writes output into a per-project folder under:

~/Library/Developer/Xcode/DerivedData

Each folder is named after the project plus a short hash and contains:

  • Build products, including object files, the compiled .app and .dSYM debug symbols
  • Index data that powers code completion, jump-to-definition and refactoring
  • Module and compiler caches, including Swift package checkouts
  • Build logs, test results and SwiftUI preview artifacts

None of it is source code. Your project lives wherever you keep it; Derived Data only holds things Xcode can rebuild.

Why it grows so large

Derived Data is built for speed, not for storage discipline. Xcode keeps artifacts for every project you have opened and does not prune them on a schedule.

A small single-target app might sit at a few hundred megabytes. Large workspaces with several targets, Swift packages and years of history commonly reach tens of gigabytes. Measure before deciding:

du -sh ~/Library/Developer/Xcode/DerivedData
du -sh ~/Library/Developer/Xcode/DerivedData/* | sort -hr | head -20

The second command sorts individual project folders, which helps when one workspace dominates the total.

Is it safe to delete?

Yes, with one condition: quit Xcode first.

Derived Data is regenerable by definition. Deleting it does not touch your source, Git history, signing certificates, provisioning profiles or archives. Xcode recreates the folder the next time you build or open a project.

The cost is time. After deletion, the first build recompiles everything from scratch, and indexing has to run again before code completion and search feel normal. On a small project that is a few minutes; on a large workspace it can be an hour or more.

How to delete Derived Data

Quit Xcode

Close Xcode completely, not just the project window. Removing files while the IDE is running can leave stale references, incomplete indexes or a build that fails until you clean again.

Delete from Terminal

rm -rf ~/Library/Developer/Xcode/DerivedData/*

This is permanent — rm does not use the Trash. If you want an undo path, delete from Finder instead: press Shift-Command-G, paste ~/Library/Developer/Xcode/DerivedData, and move the contents to the Trash. Empty the Trash once the next build works.

If the folder itself disappears afterward, that is expected; Xcode recreates it automatically.

Use Xcode’s own cleanup for a single project

Product → Clean Build Folder (Shift-Command-K) removes build products for the open project only. It is faster than deleting everything and keeps indexes intact, but it will not reclaim space from projects you are not working on.

Verify

du -sh ~/Library/Developer/Xcode/DerivedData

Expect a small number, or no output at all if the directory is empty.

What happens on the next build

The next build is slower, and the first few minutes after reopening a project feel sluggish while Xcode indexes. Swift Package Manager dependencies are re-resolved and re-fetched from their sources, so a poor network connection can add time. Nothing in your project breaks and nothing is lost.

The other Xcode folders that hold space

Derived Data is usually the largest, but it is not the only one. The rest live under ~/Library/Developer/Xcode and ~/Library/Developer/CoreSimulator.

Archives

~/Library/Developer/Xcode/Archives stores archived builds, including the dSYM files used to symbolicate crash logs from released versions. Delete archives for apps you no longer ship, or versions you no longer support. If CI stores the same builds, keeping local copies is optional. Treat this folder with more caution than Derived Data.

iOS DeviceSupport

~/Library/Developer/Xcode/iOS DeviceSupport holds symbol files copied from physical devices, one folder per iOS version. They are regenerated the next time you connect a device running that version, but the copy takes time. Remove folders for iOS versions you no longer test against.

Simulators and runtimes

~/Library/Developer/CoreSimulator/Devices contains every simulator device and its data. Deleting a device erases its installed apps and state. To remove only simulators whose runtime is no longer installed:

xcrun simctl delete unavailable

Simulator runtimes are large — often several gigabytes each — and live in /Library/Developer/CoreSimulator/Profiles/Runtimes. List them with xcrun simctl list runtimes and remove old ones through Xcode → Settings → Platforms, or with xcrun simctl runtime delete <runtime-id> in recent Xcode versions.

How Maclean handles Xcode caches

Maclean treats Xcode as one part of a broader developer-cache scan. The free CLI covers more than 60 developer cache categories, including Xcode Derived Data, device support, simulator caches, Docker images, Kubernetes data and local AI models:

maclean scan --deep
maclean clean --tab dev-cache --dry-run

The --dry-run flag prints exactly what would be removed before anything is touched. Output can be exported as JSON for scripts, and scans can run on a schedule.

The Mac app presents the same items visually and labels each one with a risk level: regenerable, needs a re-download, or contains user data that needs confirmation. Large items go to the Trash rather than being deleted outright, so a mistake is recoverable, and protected applications are excluded from cleanup entirely.

Maclean processes everything locally — file names and paths are not uploaded. For the wider picture, including how Xcode caches appear as System Data, see Mac System Data and how to clear caches on a Mac. If you also run local models, where Ollama stores its models is the next largest win.

Bottom line

Derived Data is the safest large item on a developer Mac: it is pure build output, it comes back automatically, and the only price is a slower next build. Quit Xcode, delete the folder, and leave the Archives directory alone unless you know you no longer need those builds.

FAQ

Frequently asked questions

Does deleting DerivedData delete my source code?

No. Derived Data only contains build products, indexes, logs and caches. Your project files, Git history, signing certificates and provisioning profiles are stored elsewhere and are not touched.

Is it safe to delete DerivedData while Xcode is running?

No. Quit Xcode first. Removing files underneath a running IDE can produce incomplete builds, broken indexes and confusing errors until you clean again.

Why is my first build so slow after cleaning Derived Data?

Everything that was cached has to be recompiled, and Xcode has to rebuild its index for code completion and search. The slowdown is temporary and proportional to project size.

Should I delete Xcode Archives too?

Only if you no longer need those builds. Archives contain the archived app and dSYM files used to symbolicate crash reports from released versions. If CI stores the same artifacts, local copies are optional.

How often should I clear Derived Data?

There is no fixed schedule. Clear it when disk space is tight, when a build behaves strangely, or after finishing a large project. Routine monthly cleaning is reasonable on a small SSD.

Preview first, then clean safely

Maclean breaks down caches, app data, large files and APFS snapshots, and labels the risk of every item before deletion.

Download for Mac→