Skip to content
Edith

Guide

How to Free Disk Space on a Mac for Developers

Where Xcode, simulators, package managers and old worktrees hide gigabytes, and how to get them back without deleting work.

Updated by

Get Edith

The short answer

On a developer Mac, most reclaimable space sits in rebuildable caches: Xcode DerivedData, device support files, simulator caches, and the download caches of npm, pnpm, Cargo, Gradle, pip and Homebrew. You can measure them with du and remove them by hand, or use a Mac disk cleaner for developers such as Edith's Cleaner, which finds them, lets you review the list, and moves what you pick to the Trash instead of deleting it.

Step 1: see what is using the space

Built into macOS

Storage settings and du

Open System Settings, then General, then Storage, for a breakdown by category, including Developer. For real paths and sizes, use du in Terminal:

 df -h /
 du -sh ~/Library/Developer/Xcode/DerivedData
 du -sh ~/Library/Developer/CoreSimulator
 du -sh ~/Library/Caches/* | sort -h | tail -20

df -h / shows free space on the startup disk. The last line lists your 20 largest cache folders, biggest last.

Step 2: clear the big rebuildable caches

Built into macOS

Xcode, simulators and package managers

These commands remove data that tools download or rebuild on demand. Quit Xcode before clearing DerivedData.

 rm -rf ~/Library/Developer/Xcode/DerivedData
 xcrun simctl delete unavailable
 brew cleanup
 npm cache clean --force
 pnpm store prune
  • DerivedData holds build intermediates. Your next build is slower, then everything is back.
  • xcrun simctl delete unavailable removes simulator devices whose runtime is no longer installed, which is worth running after every Xcode upgrade.
  • brew cleanup removes old Homebrew downloads and versions. The npm and pnpm commands clear their package caches.

Where the manual route falls short

  • Every toolchain hides its cache somewhere else. Xcode uses ~/Library/Developer, npm uses ~/.npm, Cargo uses ~/.cargo, Gradle uses ~/.gradle, and editors keep their own caches under Application Support.
  • rm -rf has no undo. A typo in a path, or an Xcode archive you still needed for a crash report, is gone.
  • Project folders are the other half. Old node_modules, Cargo target folders, Python virtual environments and forgotten git worktrees spread across ~/code, and du does not tell you which ones you still use.

The Edith way: Cleaner

Cleaner knows where developer caches live: Xcode DerivedData, device support, previews and archives, simulator caches, Swift packages, CocoaPods, npm, Yarn, pnpm, Bun, pip, uv, Cargo, Go, Gradle, Maven, Android, Homebrew, Playwright, VS Code, Cursor, JetBrains and more. A scan only reads. You review every item, untick anything you want to keep, and confirm once. Everything goes to the Trash, so you can put it back until you empty the Trash.

  1. 1

    Install Cleaner

    Add Cleaner from the Extensions page, or run the install command below.

  2. 2

    Scan

    Pick a drive and scan. Each category shows its size and what it holds. From the terminal, scan prints the same totals and changes nothing.

  3. 3

    Sweep your project folders

    Point it at the folder that holds your repositories to find build output, node_modules, virtual environments and linked git worktrees. --older-than limits it to things you have not touched recently.

  4. 4

    Review, then move to the Trash

    In the app, open a category, untick what you want to keep and confirm. On the command line, clean previews until you add --yes. Name a category to keep it narrow.

  5. 5

    Empty the Trash

    The space comes back when the Trash is emptied. Until then you can restore anything.

 ed cleaner categories
 ed cleaner drives
 ed cleaner worktrees --root ~/code --older-than 1w
 ed cleaner clean --root ~/code --category worktrees --older-than 2w --yes

Cleaner leaves simulator devices and their data alone, so xcrun simctl delete unavailable is still worth running after an Xcode upgrade.

Find the rest with Disk Map

Caches are not the whole story. Edith's disk space analyzer for Mac, Disk Map, measures any folder and draws it as blocks sized by the space they use. Click into folders to find a forgotten video export or a multi-gigabyte model download, reveal it in Finder to check, then move it to the Trash.

Remove apps you no longer use

Dragging an app to the Trash leaves its support files behind. Edith's update and uninstall Mac apps extension builds a removal plan with the app and the Library files named after its bundle identifier, lets you untick any of them, and moves the rest to the Trash.

 ed maintenance scan /Applications/Example.app
 ed maintenance remove /Applications/Example.app
 ed maintenance remove /Applications/Example.app --yes

For a full cleanup session that combines all of these, see clean up a full Mac disk.

Common questions

Is it safe to delete Xcode DerivedData?

Yes. It is build output. Xcode rebuilds it the next time you build, so the only cost is a slower first build.

Should I delete Xcode archives?

Only the ones for builds you no longer ship. Archives hold the dSYM files you need to read crash reports. Cleaner leaves archives unticked by default in the app for this reason.

Why did free space not change after cleaning?

Everything is in the Trash until you empty it. macOS can also take a moment to update the free space it reports.