Xcode DerivedData: What It Is, Where It Lives, and How to Clear It
If you're an iOS or macOS developer, there's a folder on your Mac that's been quietly growing for years. It's called DerivedData, and according to our analysis of 50 developer Macs, it averages 23.4 GB per machine. Some had over 80 GB.
DerivedData is Xcode's build cache. Every time you compile a project, Xcode stores intermediate build products, index data, and logs in this folder. It's meant to speed up subsequent builds — but it never cleans up after itself.
What exactly is in DerivedData?
DerivedData lives at ~/Library/Developer/Xcode/DerivedData/ by default. Inside, you'll find one subfolder per project you've ever opened in Xcode. Each contains:
| Subfolder | Contents | Typical Size |
|---|---|---|
Build/ | Compiled binaries, object files, linked frameworks | 2–10 GB per project |
Index/ | Code completion and navigation index (SourceKit) | 500 MB–3 GB |
Logs/ | Build logs, test results, diagnostic data | 100–500 MB |
TextIndex/ | Full-text search index | 50–200 MB |
info.plist | Project metadata and workspace reference | < 1 KB |
The Build/ folder is by far the largest. It contains the full compiled output for every target, configuration (Debug/Release), and platform (simulator/device) you've ever built. A Universal framework with both arm64 and x86_64 slices can easily produce 2 GB of build artifacts per project.
Why DerivedData grows so large
Several factors make DerivedData accumulate aggressively:
1. Xcode never deletes old data
When you delete a project from your disk, its DerivedData subfolder stays behind. When you rename a workspace, Xcode creates a new subfolder rather than updating the old one. Over months and years, these orphaned folders pile up.
2. Multiple build configurations
Each combination of build configuration (Debug, Release, Profile), destination (iPhone 16 Simulator, iPad, Mac Catalyst, visionOS), and architecture produces separate build products. A project targeting 4 simulators in Debug mode creates 4× the artifacts.
3. Swift Package Manager caches
Since Xcode 13, SPM-resolved packages and their compiled products also live in DerivedData. If your project has 30 dependencies (not uncommon with SwiftUI apps), each one adds to the total. Updating dependencies doesn't remove the old compiled versions.
4. Previews and SwiftUI canvas
SwiftUI Previews generate their own build artifacts in DerivedData. If you use previews frequently (and you should), they add 500 MB–2 GB of additional data that isn't cleaned when you close the canvas.
How to find DerivedData on your Mac
The default location is:
~/Library/Developer/Xcode/DerivedData/
To see its total size, open Terminal and run:
du -sh ~/Library/Developer/Xcode/DerivedData/
To see size per project:
du -sh ~/Library/Developer/Xcode/DerivedData/*/
You can also find it in Xcode: Settings → Locations → Derived Data. There's a small arrow icon next to the path that opens it in Finder.
Note: If you've customized the DerivedData location in Xcode settings (some teams do this to use a faster external SSD), it won't be in the default path. Check your Xcode settings to confirm.
How to clear DerivedData
Method 1: Delete everything (Terminal)
The fastest approach — removes all build caches for all projects:
rm -rf ~/Library/Developer/Xcode/DerivedData/*
This is safe. Xcode regenerates what it needs on your next build. The only cost is a full rebuild instead of an incremental one — typically 1–5 minutes depending on project size.
Method 2: Delete specific projects
If you want to keep caches for your active project:
# List all projects ls ~/Library/Developer/Xcode/DerivedData/ # Delete a specific one rm -rf ~/Library/Developer/Xcode/DerivedData/MyOldProject-abcdef1234567/
Method 3: From Xcode
- Open Xcode
- Go to Product → Clean Build Folder (⇧⌘K)
- This clears only the current project's build products
Note: "Clean Build Folder" only removes the Build/Products and Build/Intermediates for the current project. It doesn't touch index data, logs, or other projects. For a full cleanup, use Method 1.
Method 4: Xcode settings
- Open Xcode → Settings → Locations
- Click the arrow next to "Derived Data" to open it in Finder
- Select folders and move to trash
Other Xcode caches you should know about
DerivedData isn't the only space Xcode uses. Here are the other major caches:
| Location | What it is | Typical size | Safe to delete? |
|---|---|---|---|
~/Library/Developer/CoreSimulator/ | iOS Simulator runtimes and data | 10–60 GB | ⚠️ Deletes simulator apps |
~/Library/Caches/com.apple.dt.Xcode/ | Xcode download cache, documentation | 2–10 GB | ✅ Yes |
~/Library/Developer/Xcode/Archives/ | Archived builds for distribution | 1–20 GB | ⚠️ Only old archives |
~/Library/Developer/Xcode/iOS DeviceSupport/ | Debug symbols per iOS version | 5–30 GB | ✅ For old iOS versions |
~/Library/Developer/Xcode/watchOS DeviceSupport/ | watchOS debug symbols | 1–5 GB | ✅ For old versions |
Combined with DerivedData, Xcode-related caches can easily total 50–150 GB on an active developer Mac. iOS Simulator runtimes are particularly aggressive — each runtime (iOS 17, 18, 19) takes 5–8 GB.
How often should you clear DerivedData?
There's no one-size-fits-all answer, but here's a practical guideline:
- Monthly: If you're not low on disk space, a monthly cleanup keeps things manageable. You'll reclaim 5–20 GB each time.
- Weekly: If you work on many projects or your Mac has limited storage (256 GB), weekly clearing prevents the folder from bloating.
- After major Xcode updates: DerivedData from the old Xcode version is useless to the new one. Clear everything after updating.
- When switching branches: If you're seeing stale build artifacts or weird compilation errors, clearing DerivedData is the standard fix.
There's effectively zero risk. The worst case is a slower next build — and that's only the first build. Subsequent incremental builds are fast again.
Skip the manual work
CleanDisk automatically finds DerivedData, simulator runtimes, and all other Xcode caches. It shows you exactly how much space each one uses and whether it's safe to delete.
Download FreeCommon issues after clearing DerivedData
"My project won't build after clearing"
This is almost always an existing build issue that was masked by cached artifacts. Clean DerivedData, then resolve any real compilation errors. Try File → Packages → Reset Package Caches if SPM dependencies aren't resolving.
"Code completion stopped working"
Xcode needs to rebuild its SourceKit index. Open your project, wait 30–60 seconds, and code completion returns. Large projects may take 2–3 minutes.
"My simulators are gone"
Clearing DerivedData does not delete simulators. If you also deleted CoreSimulator, you'll need to re-download runtimes from Xcode → Settings → Platforms.
Frequently asked questions
Is it safe to delete Xcode DerivedData?
Yes. DerivedData contains only build artifacts and index files. Xcode regenerates everything on the next build. The only cost is a slightly longer first build afterward — typically 1–5 minutes.
How much space does Xcode DerivedData use?
It varies by usage. A single large project can generate 5–15 GB. Developers working on multiple projects often have 20–50 GB in DerivedData. In our analysis of 50 developer Macs, the average was 23.4 GB, with a maximum of 83 GB.
How often should I clear DerivedData?
Most developers benefit from clearing it monthly. If you're low on disk space, check it weekly. After major Xcode updates, always clear it. There's no harm — Xcode rebuilds what it needs automatically.