How to clear developer caches on your Mac
Xcode, Homebrew, npm and Docker each have their own way to give space back, set out in their own documentation.
Developer tools keep downloads, caches and old versions so your next build or install is quick. Over time they can take a lot of space. Each tool below has its own way to clean up, and every step comes from that tool’s own documentation.
Xcode
Xcode’s settings show how much space each platform, simulator runtime and optional component uses, and let you remove the ones you don’t need.
- In Xcode, choose Xcode › Settings, then click Components in the sidebar.
- Look through the three groups: Platform Support, the platforms you can build for; Other Components, optional Xcode features; and Other Installed Platforms, the simulator runtimes for different devices and OS releases.
- Click the information button next to a component you no longer use.
- In the dialog, click Delete or Turn Off.
Xcode shows how much storage you can recover from each component before you remove it.
Apple’s documentation doesn’t cover deleting Xcode’s derived data, device support files or archives, so this guide doesn’t either.
Source: Apple Developer Documentation, Downloading and installing additional Xcode components (opens in a new tab).
Homebrew
Homebrew already tidies up after itself. It removes old versions of a formula when you upgrade it with brew upgrade, and it does extra cleanup every 30 days.
To clean up now:
# See what would be removed, without removing anything
brew cleanup --dry-run
# Remove stale lock files, outdated downloads and old versions
brew cleanup
brew cleanup removes downloads more than 120 days old. You can change that age with the HOMEBREW_CLEANUP_MAX_AGE_DAYS environment variable.
To go further:
| Command | What it removes |
|---|---|
brew cleanup --prune=all | Every file in the cache, whatever its age |
brew cleanup --scrub | Downloads of even the latest versions, except downloads for the formulae and casks you have installed |
To see where Homebrew keeps its downloads, run brew --cache. It’s usually ~/Library/Caches/Homebrew.
Source: Homebrew Documentation, brew(1) (opens in a new tab) and FAQ (opens in a new tab).
npm
npm’s documentation says you rarely need to clear its cache. The cache repairs itself, and the only reason to clear it is to get disk space back. npm never removes data from the cache on its own, so the cache grows as you install packages. It lives in ~/.npm.
To tidy the cache without emptying it:
npm cache verify
This checks the cache, removes data it no longer needs, and verifies what’s left.
To empty it completely:
npm cache clean --force
Source: npm Docs, npm-cache (opens in a new tab).
Docker
Docker doesn’t remove containers, images or volumes unless you ask it to. Start by seeing what uses the space:
docker system df -v
Then remove what isn’t in use:
docker system prune
This removes stopped containers, unused networks, dangling images and unused build cache. It asks you to confirm first, and it keeps volumes and tagged images.
Docker Desktop keeps your containers and images in one disk image on your Mac. Deleting images frees space, but deleting files inside a running container doesn’t. The space can take a few minutes to come back to your Mac. To reclaim it straight away:
docker run --privileged --pid=host docker/desktop-reclaim-space
To see where the disk image is and how much space it really uses, open Docker Desktop and go to Settings › Resources › Advanced.
Source: Docker Docs, Prune unused Docker objects (opens in a new tab) and FAQs for Docker Desktop for Mac (opens in a new tab).
Sources
- Apple Developer Documentation: Downloading and installing additional Xcode components (opens in a new tab)
- Homebrew Documentation: brew(1) (opens in a new tab)
- Homebrew Documentation: FAQ (opens in a new tab)
- npm Docs: npm-cache (opens in a new tab)
- Docker Docs: Prune unused Docker objects (opens in a new tab)
- Docker Docs: FAQs for Docker Desktop for Mac (opens in a new tab)
Every source was checked on 11 October 2026, against macOS 27.
Disk Census finds the caches and build files your developer tools leave behind, and marks which ones rebuild themselves and are safe to delete.
See how Disk Census worksMore how-tos
- How to see what’s using your Mac’s storageStorage settings show how full your disk is, which kinds of files take the most space, and the large files you can remove.
- How to free up space on your MacStart with the recommendations built into macOS, then remove the files, apps and backups you no longer need.
- What System Data means in your Mac’s storageWhat Apple says System Data holds, why you can’t clear it from Storage settings, and what does help.
- How to uninstall apps on your MacQuit the app, use its uninstaller if it has one or move it to the Trash, then empty the Trash.