Skip to content
86% off$349 $48.86code BF2026

Guides

Free Up Mac Disk Space for Developers: Caches and Commands

Developer cache paths on macOS and their cleanup commands: Xcode, npm, Homebrew, pnpm, Docker.raw, Ollama and more, plus what each costs to remove.

GuideUpdated 10 min read

On this page

To free up disk space on a Mac as a developer, start with a few places: Xcode DerivedData and simulators, package-manager caches, old node_modules folders, Docker's disk image and local AI models. Measure them with du -sh, then clean each one with its own tool: brew cleanup, npm cache clean --force, pnpm store prune, docker system prune, ollama rm <name>. Build products and caches come back on their own. Package caches and models cost a re-download. Docker's Docker.raw file should never go in the Trash.

Where disk space goes on a developer's Mac

Run this in Terminal to see how big the usual locations are. It only reads sizes. Folders you don't have are skipped silently.

bash
du -sh ~/Library/Developer ~/Library/Caches ~/.npm ~/.gradle ~/.cargo ~/Library/pnpm ~/.ollama ~/.lmstudio ~/.cache 2>/dev/null

What usually sits inside each one:

  • ~/Library/Developer: Xcode DerivedData, Archives, device support files, SwiftUI previews and simulators.
  • ~/Library/Caches: Homebrew, Yarn, pip, CocoaPods, Swift Package Manager and the Go build cache, next to ordinary app caches.
  • ~/.npm, ~/.gradle, ~/.cargo, ~/Library/pnpm: package downloads and build caches for each ecosystem.
  • ~/.ollama, ~/.lmstudio, ~/.cache: local AI model weights.

Two other big items don't show up in that list: node_modules folders spread across your projects, and Docker's virtual disk. Both have their own sections below.

For general app caches outside development, see how to clear cache on Mac safely.

Xcode and simulator data

ItemPathComes back byNotes
DerivedData~/Library/Developer/Xcode/DerivedDataRebuilt on the next buildQuit Xcode first. The next build takes longer.
SwiftUI Previews~/Library/Developer/Xcode/UserData/PreviewsRecreated when you open a preview
Simulator caches~/Library/Developer/CoreSimulator/CachesRecreated automatically
iOS / watchOS Device Support~/Library/Developer/Xcode/iOS DeviceSupport (and watchOS DeviceSupport)Copied again when that device next connectsDebug symbols per OS version.
Archives~/Library/Developer/Xcode/ArchivesNeverNeeded to symbolicate crash reports from builds you shipped. Keep recent releases.
Developer Junk with the Xcode and Simulators sections expanded, each item with a Safe, Regenerates or Review label

To clear the first four, quit Xcode and move the contents of each folder (not the folder itself) to the Trash in Finder. The step-by-step version is in how to clear Xcode cache and DerivedData.

Simulators whose runtime is no longer installed can be removed in one command.

This deletes those simulators permanently. It doesn't use the Trash and can't be undone:

bash
xcrun simctl delete unavailable

Whole simulator runtimes are removed in Xcode's Settings window (the Platforms or Components tab, depending on your Xcode version).

Package manager caches and their cleanup commands

Most of these are download caches. Clearing one doesn't touch your projects' code, but the next install fetches those packages again over the network. The Go build cache is the exception: nothing is downloaded, Go just recompiles.

CachePathCleanupRemoving it costs
Homebrew~/Library/Caches/Homebrewbrew cleanupA download if you reinstall that version
npm~/.npm/_cacachenpm cache clean --forceRe-download on next install
Yarn~/Library/Caches/Yarnyarn cache cleanRe-download on next install
pnpm store~/Library/pnpm/storepnpm store pruneProjects hard-link into it, so prune rather than trash it
pip~/Library/Caches/pippython3 -m pip cache purgeWheels re-downloaded when needed
CocoaPods~/Library/Caches/CocoaPodspod cache clean --allPod sources fetched on next pod install
Swift Package Manager~/Library/Caches/org.swift.swiftpmMove contents to the TrashRepositories cloned again on next resolve
Gradle~/.gradle/cachesStop builds, move contents to the TrashDependencies downloaded and caches rebuilt
Cargo registry~/.cargo/registry/cacheMove contents to the TrashCrate archives re-downloaded
Go build cache~/Library/Caches/go-buildgo clean -cacheNothing downloaded; go build recompiles

The commands below delete permanently. They don't use the Trash and can't be undone. Each tool refills its cache when it needs to.

Homebrew: preview what would be removed (-n is a dry run), then remove old versions and old downloads.

bash
brew cleanup -n
brew cleanup

Homebrew, everything: removes every cached download, not only old ones.

bash
brew cleanup --prune=all

npm: empties npm's download cache.

bash
npm cache clean --force

Yarn: empties Yarn's global cache.

bash
yarn cache clean

pnpm: removes packages from the store that no project references. Use this instead of deleting the store, because projects hard-link into it.

bash
pnpm store prune

pip: deletes downloaded wheels.

bash
python3 -m pip cache purge

CocoaPods: deletes all cached pod sources.

bash
pod cache clean --all

Go: empties the compiled build cache.

bash
go clean -cache

Gradle: close your IDE and stop running builds before you touch ~/.gradle/caches. Inside a Gradle project, this stops the Gradle daemons for that project's Gradle version:

bash
./gradlew --stop

Delete node_modules across old projects

Every JavaScript project has its own node_modules, and old projects keep theirs until you remove them. This lists each top-level node_modules with its size, without looking inside nested ones. It is read-only. Replace ~/Projects with the folder where you keep code:

Developer Junk with node_modules per project, a Rust target folder and Claude Code and Codex worktrees expanded
bash
find ~/Projects -type d -name node_modules -prune -exec du -sh {} +

Pointing it at your code folder rather than your whole home folder avoids macOS permission prompts for Desktop, Documents and other protected locations.

Move the ones you don't need to the Trash in Finder. If the project has a lockfile, npm install or pnpm install brings the same dependencies back. Rust projects have a similar problem with their target folders; cargo clean inside the project removes them permanently, and the next build recreates them.

Docker.raw: why you never trash it

Docker Desktop keeps all your images, containers, volumes and build cache inside one virtual disk file:

~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw

It looks like one huge file you could delete. If you trash it, you delete every image, container and volume Docker has. Free space inside it with Docker's own commands instead.

Check what is using space inside Docker (read-only):

bash
docker system df

This permanently deletes stopped containers, unused networks, dangling images and unused build cache:

bash
docker system prune

Adding -a also deletes every image no container uses, not only dangling ones. You'll pull them again later:

bash
docker system prune -a

Volumes aren't touched unless you add --volumes. Leave that off unless you're sure, because volumes often hold database data. Docker's pruning guide covers each prune command.

Delete Ollama, LM Studio and Hugging Face models

Model weights are large, and unlike caches they don't come back on their own: removing one means downloading it again before you can use it.

Developer Junk with Ollama models, shared layers and a Hugging Face cache expanded, each marked Review

Ollama stores models in ~/.ollama/models. List them first (read-only):

bash
ollama list

This deletes the model permanently. Replace <name> with a name from the list:

bash
ollama rm <name>

Ollama models built on the same base share layers. Removing one model frees only the layers no other model uses, so the space you get back can be smaller than the size ollama list shows.

LM Studio keeps models in ~/.lmstudio/models or ~/.cache/lm-studio/models, depending on the version. Move a model's folder to the Trash to remove it, and download it again from LM Studio if you need it.

Hugging Face caches downloads in ~/.cache/huggingface/hub, one models--org--name folder per model. Moving a folder to the Trash removes that model, and the library downloads it again the next time your code asks for it. Several versions of the same model are a common place to save space.

AI app caches

Desktop AI apps and editors such as Cursor, Claude, ChatGPT and Codex can keep web and GPU caches that the app rebuilds on its next launch. Look in ~/Library/Application Support/<App>/ for folders named Cache, Code Cache and GPUCache, and for the app's folder in ~/Library/Caches.

Quit the app first, then move the contents of those cache folders to the Trash. Don't trash the app's whole Application Support folder. Your chats, settings and other local data live there too.

Free up developer disk space in one pass with Gigabroom

Doing all of the above by hand means a dozen commands and folders. We built Gigabroom to measure these locations in one place, label each one, and move what you pick to the Trash rather than deleting it.

Developer Junk with Xcode, Package Manager Caches and AI Models & Caches sections and their sizes
Developer Junk measures Xcode, package caches and AI models in one place.
  1. Open Gigabroom and choose Developer Junk in the sidebar (⌘7, Command-7).
  2. Wait for it to measure. The header shows how much can be swept and how much is report-only.
  3. Review the groups: Xcode, Simulators, Package Manager Caches, Project Dependencies, AI Models & Caches and Containers & VMs. Each item shows a safety label (Safe, Regenerates or Review), a reason, and when it was last touched or used.
  4. Tick anything extra you want gone, such as an old project's node_modules or a model you no longer use. Only the caches Smart Scan also handles start selected. Review items, device support, node_modules, models and AI app caches never do.
  5. Click Sweep (or Add to Collector to combine it with other cleanups).
  6. Confirm the dialog. Items go to the Trash.
  7. Choose File ▸ Empty Trash… (⇧⌘⌫, Shift-Command-Delete) to get the space back.

What it handles differently from doing it by hand:

  • node_modules: Gigabroom searches your home folder up to 6 levels deep for ones 5 MB or larger. It only trashes a node_modules that sits next to a package.json and isn't nested inside another one.
  • Simulators: it lists simulators whose runtime is gone (never a booted one) and moves them to the Trash instead of deleting them.
  • Ollama: each model's size counts only the layers that model alone uses, and shared layers have their own row. Removing a model takes the same files as ollama rm, but they go to the Trash.
  • LM Studio and Hugging Face models are grouped when there are several versions, for example "llama · 3 versions".
  • AI app caches are skipped while the app is open. Quit it and measure again.
  • Report-only items: Docker's disk image and unused simulator runtimes are listed with their size and a button that copies the command (docker system prune, xcrun simctl runtime delete <id>). Gigabroom never runs these commands itself.
  • Undo: Edit ▸ Undo Sweep (⌘Z) puts the last sweep back, until you empty the Trash or quit the app.

If you only want the caches that regenerate, Smart Scan queues DerivedData, SwiftUI previews, simulator caches and the package-manager caches (except the pnpm store), along with your user caches and logs. It shows what you'll free and moves nothing until you confirm. It never queues node_modules, Archives, Docker or models. Gigabroom needs macOS 14 or later and is part of MacSuite; you can try it free for 7 days. The full reference is in the Developer Junk docs.

Which method to use

MethodGood forSafety netCan't do
Each tool's own commandOne cache you already know is bigNone (deletes permanently)Show you everything at once
Finder, by handSwiftPM, Gradle, Cargo, model foldersTrashTell you what is safe or shared
Gigabroom Developer JunkMeasuring and clearing everything in one passTrash, re-checks, Undo SweepPrune inside Docker, delete runtimes

Keep it in check with What Grew and exclusions

Caches refill, so the goal is noticing when they get big again rather than cleaning constantly.

  • What Grew (⌘6) compares each scan of a folder with earlier ones and lists the folders that grew or shrank most (changes under 10 MB are left out). Scan your home folder now and again a week later to see whether DerivedData, ~/.npm or ~/.ollama is filling up again. Map ▸ What Grew Heat (⇧⌘H) colors the growth on the disk map. See What Grew.
  • Exclusions in Settings ▸ Exclusions include node_modules and .git presets, both off by default. Turn them on and scans, Duplicates and Large & Old Files skip those folders, so dependency files stop cluttering duplicate and large-file results. The Disk Map needs a rescan to apply the change.
  • Don't Suggest Again on any Developer Junk item hides it from future suggestions. Use it for a model or an Archive you're keeping on purpose.

If it doesn't work

  • Free space didn't go up. Items moved to the Trash still take space until you empty it. If it's still low after emptying, macOS may keep the data in a local snapshot for a while. See storage not going down after deleting files.
  • The cache came straight back. That is expected. DerivedData returns on the next build and package caches fill on the next install. Clear them when they're large, not after every build.
  • A command says "command not found". The tool isn't installed or isn't on your PATH. If its cache folder is still there from an old install, move the folder's contents to the Trash in Finder.
  • Docker is still large after pruning. Plain docker system prune keeps any tagged image, even if no container uses it. Check docker system df, then decide whether -a is right for you.
  • Gigabroom says "Simulator details need Xcode (xcrun simctl)." Gigabroom only reads simulator details when Xcode's developer tools are set up. Simulator caches are still listed without them.
  • Gigabroom skipped an item. Each item is re-checked right before it moves. An AI app that was open, or a folder that is no longer a known developer cache, is left alone, and the reason appears in the sweep log (View Log on the result banner).

FAQ

Is it safe to delete DerivedData? Yes. It holds build products and indexes, and Xcode rebuilds them on the next build. Quit Xcode first so it isn't writing to the folder.

Does clearing the npm cache break my projects? No. Projects use their own node_modules. The cache only speeds up future installs, which download packages again afterwards.

Should I delete ~/.ollama to remove models? Use ollama rm per model instead. It removes the model and only the layers no other model needs, so your other models keep working.

For space outside development, such as photos, downloads and System Data, see how to free up space on Mac.

Every app.
One purchase.