How to free up disk space on a developer's Mac: the ten folders, in order of size
· 3 min read
Storage settings on a developer's Mac shows Applications, Documents, and a grey bar. The grey bar is the work. This is the list of what is in it, in the order it was on my own Mac, with what clearing each one costs.
0. Measure first
du -sh ~/Library/Developer/* ~/Library/Caches ~/Library/Containers/com.docker.docker \
~/Library/Application\ Support/MobileSync ~/.npm ~/.gradle ~/.cargo \
~/Library/pnpm ~/Library/Caches/Homebrew 2>/dev/null | sort -rh
Everything below is ordered by what that printed for me. Yours will differ.
1. Xcode DerivedData, 39 GB
~/Library/Developer/Xcode/DerivedData. Build output for every project you
ever opened. Xcode rebuilds it. Cost: one slow build.
rm -rf ~/Library/Developer/Xcode/DerivedData/*
2. iPhone backups, 34 GB
~/Library/Application Support/MobileSync/Backup. Full copies of every
device ever backed up here. Cost: nothing for devices that back up elsewhere;
everything for a device you no longer have and never restored. Delete from
Finder → device → Manage Backups.
3. Device support symbols, 22 GB
~/Library/Developer/Xcode/iOS DeviceSupport. One folder per iOS version
you ever attached a device on. Re-downloads on reconnect. Cost: a few
minutes the next time you debug on that version.
4. Simulator runtimes and devices, 21 GB
Runtimes are 6 to 10 GB each and old ones are never removed. Cost: one download if you need the version back.
xcrun simctl runtime list
xcrun simctl runtime delete <identifier>
xcrun simctl delete unavailable
5. Docker, 18 GB reclaimable
Inside Docker.raw. Prune frees space inside the VM; the file only shrinks
when you resize the disk image in Docker Desktop settings. Cost: images and
containers, which re-pull.
docker system df
docker system prune -a
6. App caches, 13 GB
~/Library/Caches. Regenerates. Cost: one slow launch per app. Quit the
apps first, and stay out of the neighbouring folders.
7. Package-manager caches, 10 GB
npm, pnpm, yarn, pip, Gradle, Cargo, CocoaPods, SwiftPM, Go, pub. Each keeps every version it ever downloaded. Cost: one re-download per package on the next install.
8. Xcode archives, 6 GB
~/Library/Developer/Xcode/Archives. Cost: the dSYM for that build, which
you need to read crash reports from it. Keep every shipped version; delete
the rest from Xcode's Organizer.
9. Logs and diagnostics, 3 GB
~/Library/Logs and ~/Library/Logs/DiagnosticReports. Crash reports and
app logs. Cost: nothing unless you are in the middle of debugging a crash.
10. Time Machine local snapshots, variable
Not a folder. Hourly snapshots of the whole disk, kept for 24 hours, holding blocks of everything you deleted since. This is why the number does not move after steps 1 to 9.
tmutil listlocalsnapshots /
Why deleting did not free space.
The total
192 GB on my machine, of 225 GB the tools had written. The 33 GB that stayed were archives of shipped builds, the two simulator runtimes I test on, and one iPhone backup I have not decided about.
Where Decruft fits
Decruft runs this list as one scan: every folder above with its measured
size, a line on what recreates it, a checkbox, and the Trash instead of rm.
The scan is free and needs no license. The commands on this page do the same
job if you would rather.
Questions
What is taking up space on my Mac as a developer?
Usually Xcode's DerivedData and device support, simulator runtimes, Docker's disk image, package-manager caches, and old iPhone backups. Together they are commonly 100 to 200 GB and none of them appear by name in Storage settings.
What is the safest thing to delete first on a Mac?
DerivedData, ~/Library/Caches, and package-manager caches. All three regenerate on the next build, launch or install. Then old simulator runtimes, which re-download.
Should I use a Mac cleaner or the terminal?
The terminal works for everything on this page. A cleaner saves the time of finding each folder and remembering what is in it, and Decruft moves things to the Trash so a mistake is recoverable.