DevCleaner
Menu
Skip to content
Browse guides

Free Up Disk Space on a Mac: The Developer's Guide

Your 512 GB Mac isn't full of photos. It's full of build artifacts. Here's where every major toolchain hides its cache and the exact command to clean each one.

On this page

First: find out who the offenders are

Run these and prepare to be annoyed:

du -sh ~/Library/Developer 2>/dev/null
du -sh ~/Library/Caches 2>/dev/null
du -sh ~/.npm ~/.gradle ~/.cargo ~/.m2 ~/.cocoapods 2>/dev/null
du -sh ~/Library/Caches/Homebrew 2>/dev/null

On a working developer's machine these six lines alone commonly report 50–200 GB ; nearly all of it regenerable.

The cleanup, ecosystem by ecosystem

Xcode & iOS development BIGGEST WIN

rm -rf ~/Library/Developer/Xcode/DerivedData
xcrun simctl delete unavailable

DerivedData is pure build state; deleting it costs you one full rebuild per project. Unavailable simulators are dead weight from old Xcode versions. The full breakdown ; including DeviceSupport and archives ; is in our dedicated Xcode guide; for simulator runtimes and unavailable devices specifically, see remove old iOS simulators.

JavaScript: npm, Yarn, pnpm SAFE

npm cache clean --force
yarn cache clean
pnpm store prune

These are download caches ; packages re-download on the next install. Old node_modules folders in finished projects are a separate (and often bigger) story; see can I delete node_modules? and the npm, Yarn, and pnpm cache guides.

Homebrew SAFE

brew cleanup --prune=all
brew autoremove

Removes downloaded bottles for everything already installed and uninstalls orphaned dependencies. Often worth 5–15 GB on a long-lived install.

Android & JVM: Gradle, Maven SAFE

rm -rf ~/.gradle/caches
rm -rf ~/.m2/repository

Both re-download dependencies on the next build. Expect the first build afterwards to be slow. Android Studio keeps AVD device state under ~/.android/avd; SDK system images live under the configured SDK location ; delete emulators you no longer use from Device Manager.

Python: caches vs. environments

pip cache purge

Stale virtualenvs and conda environments from abandoned projects are the bigger fish ; each can be hundreds of MB. They live wherever you created them (.venv folders, ~/miniconda3/envs).

Rust & Go SAFE

cargo cache --autoclean   # needs: cargo install cargo-cache
go clean -modcache

Rust's target/ directories inside project folders are routinely multi-GB each ; cargo clean inside a project wipes its build artifacts.

Docker CHECK FIRST

docker system df          # see what's reclaimable first
docker system prune       # stopped containers, dangling images, networks
docker builder prune      # build cache

Do not add --volumes reflexively ; volumes are where your local databases live. Inspect their owners and backups before pruning; prune is destructive, not a candidate-list preview. Full breakdown ; Docker.raw, OrbStack, Colima, and every prune tier ; in our Docker cleanup guide.

CocoaPods SAFE

pod cache clean --all

Focused guides for the next cleanup

What not to delete

  • Xcode Archives ; they hold the dSYMs you need to read crash reports from App Store versions.
  • Docker volumes ; databases, not caches.
  • Downloaded LLM models (Ollama, LM Studio) ; re-downloading 40 GB of weights hurts. Delete deliberately, not in a sweep. More in the AI tools guide.
  • Anything holding credentials or sessions ; config files, cookies, keychains. A glob that drifts too wide can log you out of everything.

Keeping it clean without thinking about it

The honest problem with the commands above isn't running them ; it's remembering to. Caches can grow back, and six months later you're staring at "Your disk is almost full" again.

FAQ

Why is my Mac full when I barely store files?
Because dev toolchains cache aggressively and never clean up. Build intermediates, package downloads and old simulators hide in ~/Library and dotfolders where Finder doesn't show them.
Is macOS "purgeable" space the same thing?
No. Purgeable space is what macOS itself can evict (iCloud-synced files, system caches). Dev caches don't count as purgeable ; the OS has no idea your DerivedData is regenerable. You have to clean it yourself.
How much can I realistically get back?
There is no fixed recovery amount. Inspect your own cache sizes and available space before and after cleanup. Sparse files, shared dependencies, snapshots and Trash can make a displayed cleanup total differ from the change in disk free space.

DevCleaner does this list for you

A free menu bar app that scans 30+ developer tools ; everything on this page plus JetBrains IDEs, Flutter, Unity, VS Code and AI coding tools. Every category is rated Safe / Warning / Danger / Dangerous+, risky items are never pre-selected, files holding logins are protected by a hard deny-list, and it warns if the app you're about to clean is still running. Optional auto-clean keeps caches below a threshold with an age filter, so fresh work is never touched.

Download DevCleaner ; free ↓
Safe cleanup free · ~12 MB · macOS 14+ · live disk badge in your menu bar
Developer ID signed · notarized by Apple

References and scope

Reviewed for DevCleaner 1.14.5 on October 4, 2026. Paths depend on tool version and configuration. Size ranges are illustrative, not measured savings or a recovery guarantee. Check the installed tool’s version/help before running cleanup commands.