Skip to content

How to free up disk space on a developer Mac

By Junaid, maker of Taskglass · Updated

Summarize this guide with

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. 1

    Measure first

    In Terminal: du -sh ~/Library/Developer/* ~/.npm ~/.cache ~/.gradle ~/.ollama 2>/dev/null | sort -h shows the biggest developer folders.

  2. 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. 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. 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. 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

WhatWhereHow to clearSafe?
Xcode DerivedData~/Library/Developer/Xcode/DerivedDataDelete the folder (Xcode quit)Yes, rebuilds
Simulators~/Library/Developer/CoreSimulatorxcrun simctl delete unavailableYes for unavailable ones
iOS DeviceSupport~/Library/Developer/Xcode/iOS DeviceSupportDelete old versionsYes, recreated when a device connects
Xcode Archives~/Library/Developer/Xcode/ArchivesOrganizer › ArchivesOnly if you don't need their debug symbols
node_modulesIn each projectnpx npkillYes, npm install restores them
Docker images and cacheDocker Desktop's disk imagedocker system pruneYes for unused ones
Homebrew cache$(brew --cache)brew cleanup --prune=allYes
Ollama models~/.ollama/modelsollama 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 works

Questions

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

More guides

See the cause on your own Mac.

Taskglass shows which app is slowing, heating or draining your Mac, and explains it in plain English. One-time purchase, 30-day money-back guarantee.