Guide
How to Free Disk Space on a Mac for Developers
Where Xcode, simulators, package managers and old worktrees hide gigabytes, and how to get them back without deleting work.
Updated by Pulkit
The short answer
On a developer Mac, most reclaimable space sits in rebuildable caches: Xcode DerivedData, device support files, simulator caches, and the download caches of npm, pnpm, Cargo, Gradle, pip and Homebrew. You can measure them with du and remove them by hand, or use a Mac disk cleaner for developers such as Edith's Cleaner, which finds them, lets you review the list, and moves what you pick to the Trash instead of deleting it.
Step 1: see what is using the space
Built into macOS
Storage settings and du
Open System Settings, then General, then Storage, for a breakdown by category, including Developer. For real paths and sizes, use du in Terminal:
df -h /du -sh ~/Library/Developer/Xcode/DerivedDatadu -sh ~/Library/Developer/CoreSimulatordu -sh ~/Library/Caches/* | sort -h | tail -20df -h / shows free space on the startup disk. The last line lists your 20 largest cache folders, biggest last.
Step 2: clear the big rebuildable caches
Built into macOS
Xcode, simulators and package managers
These commands remove data that tools download or rebuild on demand. Quit Xcode before clearing DerivedData.
rm -rf ~/Library/Developer/Xcode/DerivedDataxcrun simctl delete unavailablebrew cleanupnpm cache clean --forcepnpm store prune- DerivedData holds build intermediates. Your next build is slower, then everything is back.
xcrun simctl delete unavailableremoves simulator devices whose runtime is no longer installed, which is worth running after every Xcode upgrade.brew cleanupremoves old Homebrew downloads and versions. The npm and pnpm commands clear their package caches.
Where the manual route falls short
- Every toolchain hides its cache somewhere else. Xcode uses
~/Library/Developer, npm uses~/.npm, Cargo uses~/.cargo, Gradle uses~/.gradle, and editors keep their own caches under Application Support. rm -rfhas no undo. A typo in a path, or an Xcode archive you still needed for a crash report, is gone.- Project folders are the other half. Old
node_modules, Cargotargetfolders, Python virtual environments and forgotten git worktrees spread across~/code, anddudoes not tell you which ones you still use.
The Edith way: Cleaner
Cleaner knows where developer caches live: Xcode DerivedData, device support, previews and archives, simulator caches, Swift packages, CocoaPods, npm, Yarn, pnpm, Bun, pip, uv, Cargo, Go, Gradle, Maven, Android, Homebrew, Playwright, VS Code, Cursor, JetBrains and more. A scan only reads. You review every item, untick anything you want to keep, and confirm once. Everything goes to the Trash, so you can put it back until you empty the Trash.
- 1
Install Cleaner
Open Library in Edith, find Cleaner and click Install.
- 2
Choose where to search
On the Cleanup tab, click Choose where to search… and tick the drives and folders to scan. Add the folder that holds your repositories so Cleaner also finds build output,
node_modules, virtual environments and linked git worktrees. Saved machines from Machines can be added here too. - 3
Scan
Click Scan my Mac. A scan only reads; each category shows its size and what it holds, and Show scan log lists every place it looked.
- 4
Review, then Move to Trash
Open a category, untick anything you want to keep, and click Move to Trash. Worktrees with uncommitted changes or unpushed commits are listed apart and left in place.
- 5
Empty the Trash, or restore
The space comes back when the Trash is emptied. Until then, the Restore tab puts anything back where it was, and Protect a folder keeps a path out of every future cleanup.
From the terminal
The same scan is available as commands for scripts. clean only previews until you add --yes, and without --category it takes everything the scan found rather than the items you would tick in the app, so name a category.
ed cleaner scan --root ~/codeed cleaner clean --category derivedData --yesCleaner leaves simulator devices and their data alone, so xcrun simctl delete unavailable is still worth running after an Xcode upgrade.
Find the rest with Disk Map
Caches are not the whole story. Switch Cleaner to its Disk Map tab, Edith's disk space analyzer for Mac. Choose a folder and it is drawn as blocks sized by the space they use, with a Treemap or Rings view. Click into folders to find a forgotten video export or a multi-gigabyte model download, reveal it in Finder to check, then move it to the Trash. The Files tab finds large, old and duplicate files, with filters such as Large files, 100 MB or more and Files older than 90 days; nothing there is selected automatically.
Remove apps you no longer use
Dragging an app to the Trash leaves its support files behind. Edith's update and uninstall Mac apps extension builds a removal plan with the app and the Library files named after its bundle identifier, lets you untick any of them, and moves the rest to the Trash. Open App Updates, go to Remove, pick an app on the left, review its files and move them to the Trash. From a terminal, ed app-updates remove with the app's path previews the same plan until you add --yes.
For a full cleanup session that combines all of these, see clean up a full Mac disk.
Common questions
Is it safe to delete Xcode DerivedData?
Yes. It is build output. Xcode rebuilds it the next time you build, so the only cost is a slower first build.
Should I delete Xcode archives?
Only the ones for builds you no longer ship. Archives hold the dSYM files you need to read crash reports. Cleaner leaves archives unticked by default in the app for this reason.
Why did free space not change after cleaning?
Everything is in the Trash until you empty it. macOS can also take a moment to update the free space it reports.