Free up disk space on a Mac for developers

Updated · By the iClearer team

Short answer

On a developer’s Mac, most reclaimable space is in build caches and package downloads, and nearly all of it is safe to delete because the tools rebuild it. The biggest wins are usually Xcode DerivedData and simulators, Docker images and build cache, npm, pnpm and Yarn caches, Homebrew downloads, and downloaded AI models.

rm -rf ~/Library/Developer/Xcode/DerivedData
xcrun simctl delete unavailable
npm cache clean --force
brew cleanup --prune=all
pip cache purge
docker system prune

Xcode

WhatPathSafe?
DerivedData (build cache)~/Library/Developer/Xcode/DerivedDataYes. Rebuilt on the next build.
iOS DeviceSupport~/Library/Developer/Xcode/iOS DeviceSupportYes. Recreated when you connect a device.
Simulator data~/Library/Developer/CoreSimulatorAsk first. You lose simulator app data.
Archives~/Library/Developer/Xcode/ArchivesKeep archives of builds you shipped; they hold the symbols for crash reports.
rm -rf ~/Library/Developer/Xcode/DerivedData
xcrun simctl delete unavailable

The second command removes simulators for runtimes you no longer have installed. To remove whole simulator runtimes, open Xcode → Settings → Components (called Platforms in Xcode 15). More detail: how to delete Xcode DerivedData.

Node: npm, pnpm, Yarn and node_modules

npm cache clean --force
pnpm store prune
yarn cache clean

Old node_modules folders in projects you no longer work on add up quickly. This lists the 20 largest:

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

Deleting a node_modules folder is safe. Run your package manager’s install command to bring it back. More detail: how to clear npm cache and node_modules.

Python and AI tooling

pip cache purge
uv cache clean

Many tools also write to ~/.cache, including Hugging Face downloads. Downloaded models are often the largest thing on the disk. For Ollama:

ollama list
ollama rm <model-name>

Note: models are safe to remove but slow to get back. You will have to download them again.

Where each tool keeps its models: delete Ollama models on Mac.

Homebrew

brew cleanup --prune=all
brew autoremove

The first removes old versions and every cached download. The second removes dependencies nothing needs any more.

Docker

See what Docker is using first:

docker system df

Then remove stopped containers, unused networks, dangling images and build cache:

docker system prune

Careful: docker system prune -a --volumes also removes every image not used by a running container and all unused volumes. Volumes can hold database data that cannot be rebuilt.

Docker Desktop keeps everything inside one disk image, so Finder shows a single large file. Use the Docker commands rather than deleting that file by hand. More detail: Docker taking up too much space on Mac.

CocoaPods and Gradle

pod cache clean --all
rm -rf ~/.gradle/caches

Both download what they need on the next build.

Cursor and VS Code

The caches are safe to clear: ~/Library/Application Support/Cursor/Cache, ~/Library/Application Support/Cursor/CachedData and ~/Library/Application Support/Code/Cache.

Do not delete the User folder next to them. It holds your settings, keybindings, extensions state and chat history.

What to never delete

iClearer has a Builders pack for this

iClearer’s Builders screen finds npm, pnpm, Yarn, pip and Homebrew caches, Xcode DerivedData, CocoaPods and Gradle caches, Cursor and VS Code caches, iOS Simulator data, Docker data and Ollama models, with the size of each. Rebuildable caches are labelled Safe; simulators, Docker and models are Ask first. API tokens, SSH keys, .env files and git repositories can never be selected.

Scanning is free on every Mac and the free plan includes 500 MB of cleanup. Unlimited cleanup starts at $29.99 per year for one Mac, with a 14-day money-back guarantee. Needs macOS 13 Ventura or later, Intel or Apple silicon.

Frequently asked questions

Is it safe to delete Xcode DerivedData?

Yes. DerivedData is Xcode’s build cache and index. Deleting it is safe; Xcode rebuilds it the next time you build, so that build will take longer than usual.

Is it safe to delete the npm cache?

Yes. The npm cache in ~/.npm holds downloaded packages. Run npm cache clean --force to clear it. npm downloads packages again when you next install them.

What does docker system prune remove?

It removes stopped containers, unused networks, dangling images and build cache. It does not remove volumes or images that are still tagged unless you add -a and --volumes, which can delete data you want to keep.

Why is my Mac storage full after installing Xcode?

Xcode itself is large, and it adds simulator runtimes, device support files and a DerivedData build cache that grows with every project. Deleting DerivedData and unused simulators usually returns the most space.

How do I find which developer folders are using the most space?

Run du -sh ~/Library/Developer ~/.npm ~/.cache ~/.gradle ~/.docker 2>/dev/null in Terminal to see the size of the common ones, or use a disk cleaner such as iClearer that lists developer caches by size.

Related guides