Free Disk Space for Developers on Mac: A Dev-Junk Roundup
In short: Developer tooling quietly eats disk. Xcode caches, node_modules graveyards, Docker layers, and stale package caches can add up to tens of gigabytes. Here is where that space hides and how to reclaim it without breaking your builds.
If you write code on a Mac, your drive fills faster than anyone else's. Every build, container image, and dependency install leaves something behind. The good news: most of it is regenerable junk, not real work. Here is a practical roundup of where developer junk hides and how to free disk space for developers Mac setups accumulate over months, without risking anything you actually need.
One rule before you start: always preview before you delete, and prefer moving things to the Trash so a mistake is a two-click undo, not a disaster. Regenerable caches are cheap to lose; your source code is not.
Xcode Is Usually the Biggest Offender
If you build iOS or macOS apps, Xcode is almost always your top space hog. Three folders grow without bound:
- DerivedData at ~/Library/Developer/Xcode/DerivedData holds build intermediates and indexes. It is safe to delete; Xcode rebuilds it on the next build. This alone is often 10-40 GB.
- Old device support at ~/Library/Developer/Xcode/iOS DeviceSupport keeps symbols for every iOS version you have ever connected. You only need the ones you still test against.
- Unavailable simulators. Run xcrun simctl delete unavailable in Terminal to remove simulator runtimes tied to Xcode versions you no longer have.
You can also open Xcode, go to Settings > Components, and remove old simulator runtimes you never launch. Each runtime is several gigabytes.
node_modules and Package Caches Everywhere
JavaScript projects are notorious for the node_modules folder, which can be hundreds of megabytes each. If you have a folder of old side projects, those add up. You do not have to keep every project's dependencies installed; a single npm install or pnpm install restores them from your package.json.
The shared caches are separate and safe to prune:
- npm: npm cache clean --force
- Yarn: yarn cache clean
- pnpm: pnpm store prune (removes packages no project references)
- Homebrew: brew cleanup clears old formula versions and download caches
- CocoaPods: ~/Library/Caches/CocoaPods can be emptied
To find heavy node_modules folders fast, run du -sh */node_modules 2>/dev/null inside your projects directory, or use a disk visualizer to spot the biggest ones before you touch anything.
Docker, Containers, and Virtual Machines
Docker Desktop silently accumulates stopped containers, dangling images, and unused volumes. Its disk image can balloon to tens of gigabytes. The safe cleanup is docker system prune, and if you want to include volumes you are sure you do not need, docker system prune --volumes. Review the summary Docker prints before confirming, because volumes can hold data you care about.
If you have retired VMs in Parallels, VMware, or UTM, a single virtual disk can be 30-60 GB. Deleting a VM you no longer boot is often the fastest single win on the whole machine.
Language and Toolchain Caches
Beyond JavaScript, most ecosystems keep a global cache:
- Python: pip cache lives at ~/Library/Caches/pip; clear it with pip cache purge. Old virtualenvs for dead projects are also fair game.
- Rust: ~/.cargo and per-project target folders grow large. cargo clean inside a project wipes its build output.
- Go: the module and build cache respond to go clean -cache -modcache.
- Gradle / Android: ~/.gradle/caches and ~/.android can hold many gigabytes if you do Android work.
A Quick Word on Safety and Privacy
Everything above is regenerable, but treat deletions with respect anyway. When possible, send removals to the Trash rather than permanently deleting, so an accidental grab of the wrong folder is reversible with a simple restore. Never delete anything inside /System, and avoid guessing at folders whose purpose you do not recognize.
On privacy: a disk cleaner has no legitimate reason to phone home. If you use a third-party tool, you can verify its behavior with a firewall like Little Snitch and confirm it makes zero outbound connections while it scans and cleans.
If You Want a Tool to Do the Sweep
You can reclaim most of this by hand, but a good tool makes the dev-junk sweep faster and safer by previewing everything first. If you want one, my top free pick is CoreSweep — free forever with an optional one-time Pro at $49, zero telemetry, and deletions that go to the Trash so they stay reversible. A strong best-value runner-up is SkoonMac, which is free with a one-time $19 Pro. Either way, review the preview, keep your source code, and let the Trash be your safety net.
Between Xcode DerivedData, container images, stray node_modules, and toolchain caches, most developers can recover tens of gigabytes in an afternoon — and it all comes back the next time you build.
Frequently asked questions
Is it safe to delete Xcode's DerivedData folder?
Yes. DerivedData at ~/Library/Developer/Xcode/DerivedData holds build intermediates and indexes, and Xcode rebuilds it automatically on your next build. It is often 10-40 GB, so clearing it is usually the single biggest win, and it never touches your source code. To be extra safe, send it to the Trash so restoring is a two-click undo.
Can I delete node_modules folders to free up space on my Mac?
Yes. A node_modules folder is regenerable junk, not real work, and a single npm install or pnpm install restores it from your package.json. You can safely remove it from old side projects and reinstall dependencies whenever you return to them. Just keep your source code and package.json, which are the parts you actually need.
How do I safely clean up Docker disk space on a Mac?
Run docker system prune to remove stopped containers, dangling images, and unused build cache, which is the safe default. Only add --volumes if you are sure you do not need the data, because volumes can hold databases and files you care about. Review the summary Docker prints before confirming so nothing important is removed.
The easy way to do this safely
If you'd rather not do it by hand, the two cleaners we rate highest run with a preview first and the Trash as a safety net — and neither sends any data off your Mac.
CoreSweep (free to use; Pro a one-time $49) is our top pick. SkoonMac (free; Pro $19 once) is the best-value runner-up. See the full comparison.