Free up disk space on a developer's Mac

On a developer's Mac the space usually goes to package caches, Xcode's build files and simulators, Docker's disk, build folders inside projects, and downloaded AI models. Package caches and Xcode's DerivedData are safe to delete: the tools download or rebuild them. Docker's disk, pnpm's store, and folders like ~/.gradle and ~/.m2 are not: use each tool's own cleanup command.

Updated What is StorageJanitor?

In short

  • Safe to delete: Xcode's DerivedData, and the npm, Yarn, pip, uv and Homebrew caches. The tools rebuild them.
  • Don't delete Docker's folder or pnpm's store. Use docker system prune and pnpm store prune.
  • ~/.gradle and ~/.m2 also hold settings that can contain passwords and signing keys. Those do not come back.
  • Old projects keep their node_modules and build folders. Across many projects they add up.

Where the space goes

StorageJanitor started as this exact problem. On the Mac it was first built for, System Data showed 127 GB. The largest folders turned out to be Yarn's cache at 45 GB, npm's cache at 21 GB, Docker's disk at 19 GB, and the Puppeteer and uv caches at about 16 GB together. About 66 GB came back.

macOS's storage screen names none of those folders. Most of that space was counted as System Data.

Safe to delete: the tool rebuilds it

These hold copies a tool can download or build again.

  • Xcode build filesXcode recreates them on your next build.Safe to delete
  • Package manager cachesnpm, Yarn, pip and uv download packages again when a project needs them.Safe to delete
  • Homebrew downloadsKept only to reinstall faster.Safe to delete

Most of these tools have a command of their own that does the same job:

ToolCommandWhat it removes
npmnpm cache clean --forceEvery package in npm's cache
Yarnyarn cache cleanEvery package in Yarn's cache
pippip cache purgeEvery package pip downloaded
uvuv cache cleanEvery package in uv's cache
Homebrewbrew cleanupOld versions and outdated downloads
Gogo clean -cacheThe build cache

Check first: deleting the folder costs you something

These look like caches, and several are very large. Deleting the folder itself loses work, breaks a tool, or frees far less than its size suggests. Each has a safer way.

  • Docker's diskYour containers, images and volumes live here.Check first
  • Simulators and Xcode archivesRemove them from inside Xcode.Check first
  • AI models and test browsersThey come back, but can take a long time to download.Check first
  • Toolchains and IDE cachesRemoving them can break a tool or lose settings.Check first

Build folders inside your projects

Every project keeps its own copy of what it installed or built: node_modules, a Rust or Java target folder, a Python environment. Across many projects they add up, and old projects keep theirs forever.

StorageJanitor finds them by their shape, wherever the project lives. Build output a tool recreates, such as Rust, Java and Swift build folders, is Safe to delete. node_modules, Python environments, CocoaPods and Terraform folders are Check first, so they are moved to the Trash.

See the size before you remove anything

To measure one folder in Terminal:

du -sh ~/Library/Developer/Xcode/DerivedData

To see what Docker is using:

docker system df

StorageJanitor measures all of these in one scan, lists them under Developer with their sizes, and shows the exact list before anything is removed.

StorageJanitor's storage screen: the whole disk as one bar, with a list of the biggest items and a verdict on each
From a demo scan, not a real Mac.
  • Photos & videos 52.3 GB
  • Documents 28.6 GB
  • Applications 21.4 GB
  • App data 22.6 GB
  • App caches 13.1 GB
  • System files 9.4 GB
  • Logs 1.3 GB
From a demo scan, not a real Mac. Measured from the files, so it won't match System Settings exactly.

Questions people ask

Is it safe to delete Xcode's DerivedData?

Yes. DerivedData holds build files, and Xcode recreates them on your next build. The first build afterwards is slower.

Is it safe to delete node_modules?

Yes, if the project still has its package.json and lockfile: your package manager installs everything again. StorageJanitor marks node_modules Check first and moves it to the Trash, because reinstalling needs a connection and time.

How do I free up Docker disk space on a Mac?

Run docker system df to see what is using it, then docker system prune to remove stopped containers, unused networks, dangling images and unused build cache. Don't delete Docker's folder in ~/Library/Containers: that removes every container, every image and the data in your volumes.

Can I delete the ~/.npm folder?

Delete the cache inside it, not the folder. ~/.npm/_cacache holds packages npm downloaded before, and npm fetches them again the next time a project asks for them. npm cache clean --force does the same thing.

Is it safe to delete ~/.gradle or ~/.m2?

Not without looking. The downloaded packages come back on the next build, but your Gradle and Maven settings are in those folders too. They can hold signing keys and repository passwords, and those do not come back.

Read next

Find the developer files filling your Mac

One scan measures the caches, build folders and model stores, with a verdict on each. Scanning is free.

Coming soonSee how it works
  • Free to scan and to remove up to 2 GB in total
  • $9.99 once for the full version
  • For Apple Silicon Macs

Coming soon: not available to download yet. Prices are what it will cost at launch.