If your Xcode build is behaving strangely — autocomplete broken, index out of date, or a clean build mysteriously failing — the first thing most iOS and macOS developers reach for is clearing DerivedData. Knowing how to clear DerivedData in Xcode is a routine maintenance task, but there are three distinct ways to do it, each with different trade-offs. This guide walks through all three methods so you can choose what fits your situation.
What Is DerivedData and Is It Safe to Delete?
DerivedData is a folder Xcode uses to store build artifacts, indexes, and module caches for every project you open. The default location is:
~/Library/Developer/Xcode/DerivedData/
It is safe to delete. Xcode regenerates the entire folder the next time you open a project or trigger a build. The downside is that your first build after clearing it will be slower than usual because everything has to compile from scratch. No source code, project settings, or personal data lives here — only cached build products.
Method 1: Clear DerivedData from Xcode Settings (Recommended for Most Developers)
This is the safest and most accessible route because Xcode handles the deletion itself, and you can see the current size before committing.
- Open Xcode.
- From the menu bar, choose Xcode → Settings (or press ⌘,).
- Click the Locations tab.
- Next to Derived Data, you will see the current path and a small arrow icon. Click the arrow to reveal the folder in Finder if you want to inspect it first.
- Click the Delete button (represented by a small trash icon next to the path field).
- Confirm the deletion in the dialog that appears.
Xcode deletes only the DerivedData folder contents; your project files are untouched. After deletion, close and reopen your project to trigger a fresh index and build.
Pros and Cons
- Pro: No risk of accidentally deleting the wrong folder.
- Pro: Works regardless of whether you have changed the DerivedData path in Settings.
- Con: Requires Xcode to be installed and launchable — not useful if Xcode itself is crashing.
Method 2: Delete DerivedData via Finder (The xcode delete derived data Shortcut for Non-Terminal Users)
If Xcode is not opening or you prefer a visual approach, you can delete the folder directly in Finder.
- Quit Xcode completely (⌘Q).
- Open a new Finder window.
- From the menu bar, choose Go → Go to Folder… (or press ⇧⌘G).
- Type or paste the path below and press Return:
~/Library/Developer/Xcode/DerivedData - Select all the project folders inside DerivedData (press ⌘A to select all, or select individual project entries if you want to clear only one).
- Move them to the Trash with ⌘Delete, then empty the Trash.
You can also delete just one project's derived data by selecting only that subfolder — useful when you want to preserve build caches for other projects.
Pros and Cons
- Pro: Works even if Xcode will not launch.
- Pro: Lets you selectively clear a single project instead of everything.
- Con: Requires navigating a hidden Library folder; easy to mistype the path.
- Con: Does not warn you about size; you may be surprised by how much space is freed.
Method 3: Clear DerivedData from Terminal (rm -rf)
This is the fastest method and the preferred choice for developers who live in the terminal or who want to script periodic cleanup.
- Quit Xcode if it is running.
- Open Terminal (Applications → Utilities → Terminal, or use Spotlight with ⌘Space).
- Run the following command:
rm -rf ~/Library/Developer/Xcode/DerivedData
That is it. The command deletes the entire DerivedData directory. Xcode will recreate it automatically on the next launch.
If you want to be slightly more cautious and only empty the contents while leaving the parent folder in place, use:
rm -rf ~/Library/Developer/Xcode/DerivedData/*
You can also check the size of DerivedData before deleting — especially useful if you are not sure how much space you will reclaim:
du -sh ~/Library/Developer/Xcode/DerivedData
Pros and Cons
- Pro: Fastest method; works over SSH and in CI pipelines.
- Pro: Easy to add to a script or Makefile for automated cleanup.
- Con:
rm -rfis permanent and irreversible — double-check the path before pressing Return. - Con: No size preview; you do not know how much space is involved until after deletion.
Method Comparison at a Glance
| Method | Requires Xcode | Shows Size First | Selective Delete | Scriptable |
|---|---|---|---|---|
| Xcode Settings | Yes | No | No | No |
| Finder | No | No (check Get Info) | Yes | No |
| Terminal rm -rf | No | With du -sh first | Partial | Yes |
| Crumb | No | Yes | Yes | No |
Bonus: Preview Size and Clear with One Click Using Crumb
If you want to see exactly how much space DerivedData is consuming before deleting it — without opening Terminal — Crumb handles this well. Its Visualize mode maps your entire disk and surfaces large folders like DerivedData by size, so you can confirm the scope before committing. The one-click Clean also sweeps Xcode-related caches as part of a broader system cleanup, which is useful when DerivedData is only one of several things bloating your Developer folder. You can download Crumb and use the cleanup feature for free.
When Should You Clear DerivedData?
- Xcode autocomplete or indexing is broken or severely outdated.
- A build fails with errors that do not correspond to any real code problem.
- After a major Xcode version upgrade (e.g., moving from Xcode 15 to Xcode 16 or 26).
- Your Mac is running low on storage and you want to reclaim space without deleting anything irreplaceable.
- You have switched between multiple Xcode versions and suspect stale artifacts.
DerivedData can grow to tens of gigabytes on a machine used for active development across multiple projects. Clearing it a few times per year is a normal and entirely safe habit.
What You Should Not Delete
While DerivedData is safe, a few nearby folders are not:
- ~/Library/Developer/Xcode/Archives — contains your app archives used for distribution. Do not delete unless you have copies stored elsewhere.
- ~/Library/Developer/Xcode/iOS DeviceSupport — device symbol files; safe to delete for devices you no longer use, but you will need to re-download symbols for any device you reconnect.
- ~/Library/MobileDevice/Provisioning Profiles — certificate-linked provisioning profiles; removing them can break code signing until you reinstall.
Conclusion
All three methods for clearing Xcode DerivedData work reliably on macOS 12 through macOS 26 (Tahoe). Use Xcode Settings when you want the safest GUI option, Finder when you need to be selective or Xcode will not open, and Terminal when speed or automation matters. The deletion itself is permanent, so confirming the path before running rm -rf is always worth the extra second.