How to free up disk space on a developer Mac
By Junaid, maker of Taskglass · Updated
On a developer Mac, most lost space is regenerable: Xcode's DerivedData and simulators, old node_modules folders, Docker images, and package-manager caches (npm, pnpm, Homebrew, pip). All of these rebuild or re-download when needed, so clearing them is safe; the only cost is a slower first build afterwards.
How to find and clear developer junk
- 1
Measure first
In Terminal: du -sh ~/Library/Developer/* ~/.npm ~/.cache ~/.gradle ~/.ollama 2>/dev/null | sort -h shows the biggest developer folders.
- 2
Clear Xcode build data
Quit Xcode, then delete ~/Library/Developer/Xcode/DerivedData. Remove simulators for runtimes you no longer have with xcrun simctl delete unavailable, and old iOS runtimes in Xcode › Settings › Components.
- 3
Remove old node_modules
npx npkill lists every node_modules folder with its size so you can delete the ones in projects you aren't working on. npm install brings them back.
- 4
Prune Docker
docker system df shows what Docker uses; docker system prune removes stopped containers, unused networks and dangling images (add -a to remove all unused images).
- 5
Clean package caches
npm cache clean --force, pnpm store prune, brew cleanup --prune=all, pip cache purge and uv cache clean each clear their caches. They re-download what's needed later.
Developer space hogs at a glance
| What | Where | How to clear | Safe? |
|---|---|---|---|
| Xcode DerivedData | ~/Library/Developer/Xcode/DerivedData | Delete the folder (Xcode quit) | Yes, rebuilds |
| Simulators | ~/Library/Developer/CoreSimulator | xcrun simctl delete unavailable | Yes for unavailable ones |
| iOS DeviceSupport | ~/Library/Developer/Xcode/iOS DeviceSupport | Delete old versions | Yes, recreated when a device connects |
| Xcode Archives | ~/Library/Developer/Xcode/Archives | Organizer › Archives | Only if you don't need their debug symbols |
| node_modules | In each project | npx npkill | Yes, npm install restores them |
| Docker images and cache | Docker Desktop's disk image | docker system prune | Yes for unused ones |
| Homebrew cache | $(brew --cache) | brew cleanup --prune=all | Yes |
| Ollama models | ~/.ollama/models | ollama rm <model> | Yes, re-downloadable |
Is it safe to delete Xcode DerivedData?
Yes. DerivedData holds build products, indexes and logs that Xcode regenerates. Quit Xcode first; the next build and indexing take longer while it's rebuilt.
Why doesn't Docker free disk space after I delete images?
Docker Desktop stores everything in one disk image. Prune unused data first; recent Docker Desktop versions then give the space back to macOS, and Settings › Resources shows the disk usage limit if you want a smaller one.
What about Gradle and Android emulators?
~/.gradle/caches rebuilds on the next build and can be deleted while no build runs. Delete unused emulators in Android Studio's Device Manager rather than by hand.
How Taskglass helps
Taskglass flags a nearly full disk in its diagnosis and shows which AI agents and dev servers are running, so you can stop them before clearing their caches.
See how it worksQuestions
How much space does Xcode use?
Xcode itself is about 10–15 GB, and DerivedData, simulators and device support files can add tens of GB more over time.
Can I delete ~/Library/Developer?
Not the whole folder. Delete the regenerable parts (DerivedData, unavailable simulators, old device support) and keep Archives you may need for crash symbolication.
What does npkill do?
It's an open-source command-line tool (run with npx npkill) that finds node_modules folders and lets you delete them one by one, showing how much space each frees.
Processes you might see
- XcodeApple's app for building Mac, iPhone and iPad apps.
- SourceKitServicePowers Swift code completion, syntax highlighting and error checking in Xcode.
- Docker DesktopDocker's app for running containers on a Mac inside a lightweight Linux virtual machine.
- com.docker.virtualizationRuns Docker Desktop's Linux virtual machine, where your containers actually live.
- node (Node.js)Node.js, the JavaScript runtime used by developer tools, local servers and some apps.
- OllamaRuns AI language models locally on your Mac.
More guides
- Why is my Mac so slow?
- Why is my Mac so hot?
- Why is my Mac fan so loud?
- What's draining my MacBook battery?
- Task Manager on Mac: how to see and close running apps
- How to ask Claude why your Mac is slow
- Is Claude Code slowing down your Mac?
- What is System Data on Mac, and how do I reduce it?
- How much RAM do I need on a Mac for coding?
- Can you run Ollama on a 16 GB Mac?