The Developer's Guide to Reclaiming Disk Space on macOS
Xcode DerivedData, npm caches, Docker layers, Cargo registries — a developer's guide to the caches silently eating your disk space.
If you're a developer, your Mac is accumulating cache data at a rate that would surprise most users. Every build tool, package manager, and IDE creates its own cache, and they rarely clean up after themselves.
Here's a comprehensive guide to what's consuming your space and how to safely reclaim it.
Xcode: the biggest offender
If you do any Apple platform development, Xcode is likely your single largest storage consumer.
DerivedData (~/Library/Developer/Xcode/DerivedData/) This folder stores build artifacts, indexes, and intermediate files for every project you open in Xcode. Each project gets its own subfolder, and they persist indefinitely. On an active developer's machine, this folder commonly reaches 20-50 GB.
The good news: DerivedData is entirely safe to delete. Xcode will rebuild everything it needs the next time you open a project. The downside is a slightly longer first build.
Archives (~/Library/Developer/Xcode/Archives/) Every time you archive a build for distribution, Xcode saves it here. Old archives from apps you no longer maintain can consume significant space.
iOS/watchOS DeviceSupport (~/Library/Developer/Xcode/iOS DeviceSupport/) When you connect a physical device to Xcode, it downloads debug symbols for that device's OS version. Each version takes 2-5 GB. If you've connected devices running multiple iOS versions, this adds up quickly.
Simulator data iOS Simulator runtime images and device data can consume 5-20 GB depending on how many simulator configurations you have.
Package manager caches
Every package manager maintains a local cache to speed up installations. Here are the most common ones and their typical sizes:
JavaScript ecosystem: - npm cache (~/.npm/_cacache) — 500 MB to several GB - Yarn cache (~/.yarn/cache + ~/Library/Caches/Yarn) — Similar to npm - pnpm store (~/.pnpm-store) — Can be very large as it stores all package versions - Bun cache (~/.bun/install/cache) — Growing as Bun adoption increases
Python ecosystem: - pip cache (~/Library/Caches/pip) — 200 MB to 2 GB - uv cache (~/.cache/uv) — Similar to pip but newer - Poetry cache (~/.cache/poetry) — Per-project virtual environments - pyenv cache (~/.pyenv/cache) — Python source tarballs
Rust: - Cargo registry (~/.cargo/registry/cache) — Downloaded crate tarballs - Rustup downloads (~/.rustup/downloads) — Toolchain installers
Go: - Build cache (~/Library/Caches/go-build) — Compiled packages - Module cache (~/go/pkg/mod/cache) — Downloaded module source
Java/Kotlin: - Gradle cache (~/.gradle/caches) — Often 2-10 GB with multiple versions - Maven repository (~/.m2/repository) — Downloaded dependencies
iOS: - CocoaPods cache (~/Library/Caches/CocoaPods) — Pod source and specs - Carthage cache (~/Library/Caches/org.carthage.CarthageKit) — Built frameworks
Other: - Docker buildx cache (~/.docker/buildx/cache) - Hugging Face models (~/.cache/huggingface) — Can be enormous (10+ GB per model) - PyTorch cache (~/.cache/torch) — Model weights
Project build artifacts
Beyond global caches, every project directory accumulates build artifacts:
- node_modules — Often 200-500 MB per project, and you probably have dozens of projects
- venv / .venv — Python virtual environments with copies of all dependencies
- .next / .nuxt — Next.js and Nuxt.js build output
- build / dist — Generic build output directories
- Pods — CocoaPods dependencies (iOS projects)
- DerivedData — Xcode build data in project directories
- target — Rust/Cargo build artifacts (often 1-5 GB per project)
- .gradle — Gradle build cache per project
A developer with 20-30 projects can easily have 50+ GB of build artifacts scattered across project directories.
What's safe to delete?
All of the caches listed above are safe to delete. Package managers will re-download what they need on the next install. Build tools will rebuild on the next build. The only cost is time — the next build or install will be slower as caches are rebuilt.
The key is never deleting source code, configuration files, or credentials. Stick to cache directories and build artifacts.
The systematic approach
Manually finding and cleaning all these locations is possible but tedious. You'd need to check 38+ different paths and remember which ones exist on your system.
CleanMyMacOS scans all of these automatically — Xcode cleanup across 6 categories, Homebrew, 38+ package manager caches, and project folder scanning for 15+ cleanable directory types. Everything is presented with sizes so you can make informed decisions about what to clean.
CleanMyMacOS can help with this — download it free from the Mac App Store.