Xcode DerivedData: Delete Safely and Free Space on Mac
Deleting Xcode DerivedData is safe. Here is what else you can clear on a developer Mac, with paths, safety labels, commands and what each one costs you.
GuideUpdated 6 min read
On this page
You searched for whether it is safe to delete DerivedData and free space on your Mac. DerivedData is only one of several developer folders that grow quietly: simulator caches, old runtimes, Homebrew downloads, npm and pip caches, node_modules. This guide covers each one, what it costs you to clear, and what to leave alone.
Why developer folders get so big
Build tools cache aggressively because rebuilding and re-downloading is slow. Nothing cleans those caches for you, and they live in hidden or rarely opened places such as ~/Library/Developer, ~/Library/Caches and dot-folders in your home directory.
Most of it is regenerated data. "Safe" here means regenerated, not free: a cleared npm or Gradle cache means a slower next install, and a cleared DeviceSupport folder means a wait the next time you plug that device in. A few items are different: Xcode Archives, the pnpm store and Docker's disk image need a decision or a different tool.
Which folders are safe to delete
The last column uses the safety labels Gigabroom shows for the same locations.
| Item | Path | Safe to delete? | What happens afterward | Gigabroom label |
|---|---|---|---|---|
| Xcode DerivedData | ~/Library/Developer/Xcode/DerivedData | Yes | Xcode rebuilds it; next build is slower | Regenerates |
| SwiftUI Previews | ~/Library/Developer/Xcode/UserData/Previews | Yes | Recreated when you open a preview | Regenerates |
| Simulator caches | ~/Library/Developer/CoreSimulator/Caches | Yes | CoreSimulator recreates them | Safe |
| iOS DeviceSupport | ~/Library/Developer/Xcode/iOS DeviceSupport | Yes, with a cost | Symbols copied again when that device connects | Regenerates |
| watchOS DeviceSupport | ~/Library/Developer/Xcode/watchOS DeviceSupport | Yes, with a cost | Copied again when the watch connects | Regenerates |
| Homebrew cache | ~/Library/Caches/Homebrew | Yes | Bottles download again when needed | Safe |
node_modules | next to package.json | Yes | Reinstall from the lockfile | Regenerates |
| Xcode Archives | ~/Library/Developer/Xcode/Archives | Think first | Needed to symbolicate crash reports of shipped builds | Review |
| pnpm store | ~/Library/pnpm/store | Think first | Projects hard-link into it | Review |
| Docker disk image | ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw | Never trash it | Free space from inside Docker | Review, report only |
Before you start
- Quit Xcode and stop running builds and simulators.
- See what is actually big. This only reads sizes and changes nothing:
du -sh ~/Library/Developer/* 2>/dev/nullStep-by-step fixes
Clear DerivedData with Finder
- In Finder, choose Go > Go to Folder… (Command-Shift-G).
- Type
~/Library/Developer/Xcode/DerivedDataand press Return. - Select everything inside (⌘A) and move it to the Trash (⌘⌫).
- Empty the Trash.
Delete the contents, not the folder itself. The same route works for any cache folder in the table.
Clear old simulators and runtimes
Two things take space: simulator devices whose runtime is gone, and the runtimes themselves.
To delete simulators whose runtime no longer exists (permanent):
bash xcrun simctl delete unavailableFor runtimes, open Xcode and go to Xcode > Settings > Platforms, then remove the ones you no longer test against.
Terminal also offers
xcrun simctl runtime delete <id>, where<id>is the runtime's identifier.
Clear package-manager caches
Most tools have their own cleanup command, which is better when you want to trim rather than wipe:
- Homebrew:
brew cleanupremoves old downloads and outdated versions.brew --cacheshows where the cache lives (by default~/Library/Caches/Homebrew). - pnpm:
pnpm store pruneremoves packages no project uses. Use it instead of trashing the store. - Docker:
docker system prunefrees space from inside Docker. Read Docker's pruning documentation first, and never trash the disk image file.
If you would rather not use each tool's command, these cache folders are fine to move to the Trash in Finder:
| Cache | Path |
|---|---|
| Swift Package Manager | ~/Library/Caches/org.swift.swiftpm |
| CocoaPods | ~/Library/Caches/CocoaPods |
| npm | ~/.npm/_cacache |
| Yarn | ~/Library/Caches/Yarn |
| pip | ~/Library/Caches/pip |
| Gradle | ~/.gradle/caches |
| Cargo | ~/.cargo/registry/cache |
| Go build cache | ~/Library/Caches/go-build |
Do it in one pass with Gigabroom
Checking a dozen hidden folders by hand is the tedious part. Gigabroom's Developer Junk screen measures these locations and labels each Safe, Regenerates or Review, with the reason beside it. Everything goes to the Trash after a confirmation, and your files are never sent to us. We make Gigabroom, and the Finder and Terminal methods above work fine for one folder. Gigabroom needs macOS 14 Sonoma or later.
- Open Gigabroom and choose Developer Junk under Clean in the sidebar (⌘7).
- Wait for the measurements. The header shows how much "can be swept"; the rest is report-only.
- Review the sections: Xcode, Simulators, Package Manager Caches, Project Dependencies, AI Models & Caches and Containers & VMs.
- Tick what you want. Only Smart-Scan-eligible sections start selected; Review and report-only items are never pre-selected.
- Click Sweep X and confirm "Sweep N developer items to the Trash?". Quit Xcode and running builds first.
- Empty the Trash to get the space back (File > Empty Trash…, ⇧⌘⌫).
What it adds over the manual routes:
- Reasons. Archives are tagged Review ("Needed to symbolicate crash reports of builds you shipped"). The pnpm store is tagged Review and points to
pnpm store prune. - Copyable commands for report-only items. The Docker disk image and unused simulator runtimes are never trashed. Gigabroom shows
docker system pruneorxcrun simctl runtime delete <id>for you to copy, and never runs them itself. node_modulesper project, with "touched X ago". Only one next to apackage.json, inside your home folder and not nested can be trashed, and it is never pre-selected. If the Disk Map doesn't cover your home folder, it searches home up to 6 levels deep for folders of at least 5 MB, skipping Library and hidden folders.- Undo. Edit > Undo Sweep (⌘Z) puts items back. The last 20 sweeps stay undoable in the current session.
- Smart Scan, the shorter route, queues only Safe and Regenerates items and stops at a confirm sheet. It never queues Archives, DeviceSupport, the pnpm store, Docker,
node_modulesor AI models.
Gigabroom is part of MacSuite: $349 one-time as of November 2026, with a 7-day free trial for each app. See the Developer Junk docs or the Gigabroom page.
Which method to pick
| Method | Best for | Limit |
|---|---|---|
| Finder | One folder, no new software | You must know every path; space returns only after you empty the Trash |
| Terminal | Trimming without wiping | One tool at a time; most commands are permanent |
| Gigabroom | Seeing everything at once, with labels and Undo | Part of a paid bundle after the trial |
Checklist before you delete
- Xcode, builds and simulators are closed.
- You are clearing contents, not the parent folder.
- Archives are kept if you still support those releases.
- Docker.raw and the pnpm store are untouched.
- You plan to empty the Trash afterward.
If nothing works
The space did not come back. Moved files stay in the Trash and still use space. Empty it. If free space still looks low, read Mac storage not going down after deleting files and what purgeable space is. After Empty Trash, Gigabroom reports the measured change; if much less was freed than expected, macOS may keep a copy in a local snapshot for a while (see System Data and snapshots).
The Simulators section is thin. Gigabroom lists simulator details only when ~/Library/Developer/CoreSimulator exists and xcode-select -p succeeds. Otherwise it shows "Simulator details need Xcode (xcrun simctl). Simulator caches are still listed."
An AI cache row says the app is open. Quit the app and measure again.
Gigabroom refuses an item with "Gigabroom won't trash “name”: it's a protected system, account or cloud location." Pick the items inside the folder instead.
If it still fails, contact MacSuite support with this:
Gigabroom 1.0.0 on macOS (your version). Developer Junk shows (exact message).
Steps tried: quit Xcode, measured again, emptied the Trash.
Free space before and after: (numbers). Screenshot attached.Common questions
Will deleting DerivedData break my projects?
No. It holds build products and indexes, not your source. Xcode rebuilds both.
Does DerivedData come back right away?
Xcode writes to it on every build, so it grows again after you build. That is normal. The first build after clearing is slow while indexes regenerate.
Is it safe to delete Xcode Archives?
Only if you no longer need crash symbolication for builds you shipped. Keep recent releases.
Why can't I just delete Docker.raw?
It is Docker's virtual disk. Free space from inside Docker with docker system prune.
For more, see free up disk space on a Mac for developers and how to clear the Xcode cache.