CleanMate

All guides · macOS · Updated

Free up disk space on a Mac as a developer: Xcode, node_modules, Docker, Homebrew

Where a developer Mac loses its disk space and which commands are safe: Xcode DerivedData and simulators, node_modules, Docker, Homebrew and package caches, with what each one costs you to get back.

Download for macOS — free and open source

CleanMate Smart Scan on a Mac, listing developer junk with its sizesCleanMate Smart Scan on a Mac, listing developer junk with its sizes

A Mac that builds software fills up faster than one that browses the web. Xcode keeps every build, every iOS version you ever plugged in and every simulator. Each JavaScript project carries its own node_modules. Docker hides a disk image of tens of gigabytes. Homebrew keeps old versions “just in case”.

Not a developer, or looking for the everyday steps (Trash, Downloads, large files, Mail, iPhone backups)? See how to free up disk space on a Mac.

Each tool has its own guide when you need the details: Xcode, Docker, Android Studio, JetBrains IDEs and VS Code, node_modules and build folders and Homebrew. This page is the short tour: one look and one safe command per tool. Python and AI tools have theirs too: pip, conda and uv caches and AI models from Ollama, LM Studio and Hugging Face. Removing Xcode for good: uninstall Xcode and the Command Line Tools.

None of this is broken, it is all cache and can be rebuilt. But rebuilding costs time or bandwidth, so it helps to know what you delete. This guide goes through the usual suspects: where they live, a command to look at the size, a command to clean, and what comes back on the next build.

Quit the tool before you clean its folders (Xcode, Docker, your editor), and look at the size first:

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

Xcode: DerivedData, device support, archives and simulators

DerivedData holds the build products and indexes of every project you opened. It is the safest big folder on a developer Mac: Xcode rebuilds it, you just wait for one slow build and one re-index.

# quit Xcode first
rm -rf ~/Library/Developer/Xcode/DerivedData

iOS DeviceSupport has the debug symbols Xcode copied from your devices, one folder per iOS version, often 2 to 5 GB each. List them and remove the versions you no longer test on. Xcode copies a version again the next time you connect a device running it, which takes a few minutes.

ls ~/Library/Developer/Xcode/iOS\ DeviceSupport
rm -rf ~/Library/Developer/Xcode/iOS\ DeviceSupport/<version folder>

Archives (~/Library/Developer/Xcode/Archives) are different: they are the only copy of the symbols you need to read crash reports of a build you shipped. Keep the archive of every release that is still in users’ hands, and delete the rest from Xcode’s Organizer (Window › Organizer › Archives), not with rm.

Simulators are the quiet giant. Every runtime is several GB, and every device has its own data folder.

# delete devices whose runtime is gone
xcrun simctl delete unavailable

# see the installed runtimes, then remove one you don't need
xcrun simctl runtime list
xcrun simctl runtime delete <runtime identifier>

# reset the apps and data of every device (shut them down first)
xcrun simctl shutdown all
xcrun simctl erase all

erase all turns each simulator into a fresh one: your test apps and their data are gone, the devices stay. A deleted runtime is downloaded again from Xcode › Settings › Components when you need it.

What CleanMate does. In Smart Scan’s developer group it lists DerivedData project by project, device support version by version and archives older than 90 days (moved to the Trash). It erases simulator data per device with simctl erase, only for devices that are shut down, and never deletes a device. Old simulator runtimes are listed but not ticked. All of it is skipped while Xcode runs, and you see every entry with its size before anything is removed.

node_modules you forgot about

Every project you ever cloned still has its node_modules, usually 200 MB to 1 GB. Find the biggest ones:

find ~/Developer -name node_modules -type d -prune -exec du -sh {} + 2>/dev/null | sort -h | tail -20

Change ~/Developer to where your projects live. To remove one, delete the folder inside a project you are not working on:

rm -rf ~/Developer/old-project/node_modules

npm install (or yarn, pnpm install, bun install) brings it back from the lockfile. Two cases to check first: a project that depends on packages you patched by hand inside node_modules, and one you need to run without a network.

The package managers keep a download cache on top of that. These commands are safe, the cost is a slower next install:

npm cache clean --force
pnpm store prune
yarn cache clean
bun pm cache rm
pip cache purge
uv cache clean

Rust and Go leave the biggest folders: cargo clean inside a project deletes its target/ (often several GB), and go clean -cache empties Go’s build cache. The downloaded crates in ~/.cargo/registry can also be deleted; Cargo fetches them again.

What CleanMate does. It finds node_modules of JavaScript projects untouched for 90 days, each project on its own line, not ticked, moved to the Trash so npm install can bring it back. Cargo target, Python .venv and CocoaPods Pods get the same treatment. The package caches (npm, Yarn, pnpm, Bun, pip, uv, Go, Cargo, Gradle, Maven and more) are separate items that use the tool’s own clean command when it is installed, and are skipped while that tool runs. More in node_modules and old build folders.

Docker

Check what Docker uses before you prune anything:

docker system df

Then clean in order from safest to riskiest:

docker builder prune           # build cache
docker image prune             # dangling images (no tag)
docker image prune -a          # every image no container uses
docker container prune         # stopped containers
docker volume prune            # volumes no container uses: this can be your data

docker system prune runs the container, image and build-cache steps together, plus unused networks (add -a for all unused images). Be careful with volumes: a database you stopped for the weekend has a volume that no running container uses, and docker volume prune removes it. Read docker volume ls first. With Docker 23 or newer it removes only anonymous volumes unless you add -a.

On Docker Desktop all of it lives in one disk image (Docker.raw under ~/Library/Containers/com.docker.docker/Data/vms/). After a prune the file may not shrink at once; check the real size with du -sh, not the size Finder shows, and use the disk image settings of Docker Desktop if it stays large.

What CleanMate does. It lists Docker’s build cache, untagged images, unused images, stopped containers and unused volumes as separate items, for the local daemon only, and most of them are not ticked. OrbStack caches and logs are listed too.

Homebrew

Homebrew keeps the old version of every formula you upgraded, and the bottles you downloaded.

brew cleanup -n          # dry run: shows what would go and how much
brew cleanup             # remove old versions and stale downloads
brew cleanup --prune=all # also remove every cached download
brew autoremove -n       # dry run: formulae nobody needs any more
brew autoremove

The only cost is downloading a formula again if you downgrade or reinstall. autoremove removes formulae that were installed only as a dependency of something you have uninstalled; check the dry run, because a tool you use from the command line but never installed by name can appear in it.

What CleanMate does. The Homebrew cache is one of its package-cache items. Unused dependencies are listed exactly as brew autoremove --dry-run shows them, not ticked, so you decide. More in Homebrew eating disk space.

iPhone and iPad backups

Finder keeps a full backup of every device you ever backed up, often 10 to 60 GB each, in ~/Library/Application Support/MobileSync/Backup. Do not delete the folders by hand: open Finder, select the device, click Manage Backups, and delete the old ones there. If you do want to look at the sizes in the Terminal, Terminal needs Full Disk Access.

What CleanMate does. With Full Disk Access it lists every backup with its device name and date and its own checkbox. Nothing is ticked, backups go to the Trash, and a backup that is running or was written to in the last hour is skipped.

Do it in one scan

The commands above are the whole job, and you can script them. What the script cannot do is show you every size first and keep your answers per project. CleanMate (free, open source, no account) runs the same tools for you: Smart Scan lists everything above in one view, you untick what you want to keep, and a click moves it to the Trash or runs the tool’s own clean command. Nothing is removed until you confirm. The developer junk page describes how build caches, Xcode artifacts and Docker data are handled.

Editors and VMs are covered in JetBrains and VS Code using too much disk space and virtual machines and dev infrastructure tools; Parallels, VMware Fusion and UTM machines in desktop virtual machines on a Mac.

Want your coding agent to do it? See let an AI agent clean your disk.

For mobile projects, see Flutter, React Native and the iOS Simulator filling your Mac.

Looking for a free CleanMyMac alternative? See how CleanMate compares, feature by feature.

Comparing free CleanMyMac alternatives? See CleanMate, Pearcleaner, AppCleaner and OnyX side by side.

Weighing OnyX against CleanMate? See what each one does, feature by feature.

Looking for a Pearcleaner alternative that is still updated? See how CleanMate compares.

Skip the commands

Open source — star it on GitHub: CleanMate for macOS

How CleanMate decides what is safe to remove →