Skip to content

Blog

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.

· Sources

On this page

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.

  1. In Xcode, choose Xcode › Settings, then click Components in the sidebar.
  2. 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.
  3. Click the information button next to a component you no longer use.
  4. 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:

Terminal
# 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:

CommandWhat it removes
brew cleanup --prune=allEvery file in the cache, whatever its age
brew cleanup --scrubDownloads 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:

Terminal
npm cache verify

This checks the cache, removes data it no longer needs, and verifies what’s left.

To empty it completely:

Terminal
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:

Terminal
docker system df -v

Then remove what isn’t in use:

Terminal
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:

Terminal
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

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 works