Bottom Line: Developer workstations hoard massive amounts of hidden disk space across Docker container layers, language package caches, build targets, model weights, and IDE workspace stores. Running this 5-minute terminal cleanup playbook reclaims 50 GB to 200 GB+ of SSD space safely without breaking active code repositories or environment variables.
The Developer Storage Crisis: Why Engineers Run Out of SSD Space
Software development toolchains prioritize compilation speed and package resolution speed over disk space conservation. To achieve near-instant rebuild times, build systems cash aggressively:
- Docker Desktop: Retains uncompressed container filesystems, dangling image layers, and buildkit build caches.
- Apple Xcode: Stores build index files (
DerivedData), archived app release packages (Archives), and offline iOS simulator images. - Node.js Package Managers: Duplicate global archive stores across
npm,pnpm,yarn, andbun. - Rust Cargo: Intermediate compiled
.oand.rlibbinary targets inside every local project’starget/directory. - Python & AI Frameworks: Pip wheel downloads, PyTorch model checkpoints, Hugging Face transformers, and Ollama GGUF LLM weights.
Tool-by-Tool Storage Audit & Cleanup Commands
1. Docker & Virtualization Containers — 20 GB to 80 GB
Docker’s virtual disk (ext4.vhdx on Windows/Mac) never shrinks automatically, even after stopping containers or deleting images.
# Prune stopped containers, dangling images, unused networks, and build cache
docker system prune -a --volumes -f
# Inspect remaining Docker storage usage
docker system df
For OrbStack users:
orb cleanup
2. Apple Xcode & iOS Simulator Artifacts (macOS) — 20 GB to 60 GB
Xcode is notorious for hoarding build indexes and obsolete simulators:
# Delete DerivedData build indexes (Xcode will rebuild on next compile)
rm -rf ~/Library/Developer/Xcode/DerivedData/*
# Delete unavailable or obsolete iOS simulator runtime images
xcrun simctl delete unavailable
# Delete archived app distribution bundles
rm -rf ~/Library/Developer/Xcode/Archives/*
# Delete iOS DeviceSupport symbols
rm -rf ~/Library/Developer/Xcode/iOS\ DeviceSupport/*
3. Node.js Package Managers (npm, pnpm, yarn, bun) — 10 GB to 35 GB
Package managers store compressed tarball archives of every installed dependency:
# Clear npm global cache
npm cache clean --force
# Prune pnpm global content-addressable store
pnpm store prune
# Clear Yarn global cache
yarn cache clean
# Clear Bun package cache
bun pm cache rm
4. Python, PyTorch & AI Model Weight Caches — 15 GB to 70 GB
Machine learning frameworks download massive multi-gigabyte model weights directly into hidden user home directories:
# Clear pip wheel download cache
pip cache purge
# Clear Hugging Face Transformers model cache (~/.cache/huggingface)
rm -rf ~/.cache/huggingface/hub/*
# Clear PyTorch Hub model downloads (~/.cache/torch)
rm -rf ~/.cache/torch/hub/*
# Clear Ollama GGUF model manifests (~/.ollama/models)
rm -rf ~/.ollama/models/manifests/*
5. Rust Cargo & Go Build Caches — 15 GB to 50 GB
Rust compiles binaries inside every project’s target/ directory. Over 10 active projects, this can consume over 40GB:
# Clear global Cargo registry download cache
rm -rf ~/.cargo/registry/cache/*
rm -rf ~/.cargo/registry/src/*
# Install cargo-sweep to clean old target directories automatically across all projects
cargo install cargo-sweep
cargo sweep --installed
# Clear Go build and module cache
go clean -cache -modcache
6. Java, Gradle & Maven Build Repositories — 10 GB to 40 GB
# Clear Maven local .m2 repository download cache
rm -rf ~/.m2/repository/*
# Stop Gradle daemons and clear cache
gradle --stop
rm -rf ~/.gradle/caches/*
7. IDE & Workspace Storage (VS Code, JetBrains, Android Studio) — 10 GB to 30 GB
# Clear VS Code Workspace Storage (~/Library/Application Support/Code/User/workspaceStorage)
rm -rf ~/Library/Application\ Support/Code/User/workspaceStorage/*
# Clear JetBrains (IntelliJ, PyCharm, WebStorm) system caches
rm -rf ~/Library/Caches/JetBrains/*
# Clear Android Studio build and system caches
rm -rf ~/.android/avd/*
Master One-Click Terminal Cleanup Script (macOS & Linux)
Copy and execute this complete script in your terminal to reclaim maximum developer disk space in 60 seconds:
#!/usr/bin/env bash
echo "🚀 Starting Master Developer Disk Cleanup..."
# 1. Docker
if command -v docker &> /dev/null; then
echo "🧹 Cleaning Docker..."
docker system prune -a --volumes -f
fi
# 2. Xcode (macOS)
if [ "$(uname)" == "Darwin" ]; then
echo "🧹 Cleaning Xcode & Simulators..."
rm -rf ~/Library/Developer/Xcode/DerivedData/*
xcrun simctl delete unavailable &> /dev/null
rm -rf ~/Library/Developer/Xcode/Archives/*
fi
# 3. Node.js
echo "🧹 Cleaning Node.js Package Caches..."
npm cache clean --force &> /dev/null
pnpm store prune &> /dev/null
yarn cache clean &> /dev/null
bun pm cache rm &> /dev/null
# 4. Python & AI Caches
echo "🧹 Cleaning Python & AI Model Caches..."
pip cache purge &> /dev/null
rm -rf ~/.cache/huggingface/hub/*
rm -rf ~/.cache/torch/hub/*
# 5. Rust & Go
echo "🧹 Cleaning Rust & Go Caches..."
rm -rf ~/.cargo/registry/cache/*
if command -v go &> /dev/null; then
go clean -cache -modcache &> /dev/null
fi
echo "🎉 Master Developer Disk Cleanup Complete!"
Developer Tool Storage Impact Matrix
| Developer Tool | Cache Path | Safety Verdict | Typical Size |
|---|---|---|---|
| Docker Engine | /var/lib/docker or ext4.vhdx |
⚠️ Use Caution | 20 GB – 80 GB |
| Xcode DerivedData | ~/Library/Developer/Xcode/DerivedData |
✅ 100% Safe | 15 GB – 60 GB |
| pnpm Store | ~/.pnpm-store |
✅ 100% Safe | 10 GB – 30 GB |
| Hugging Face Hub | ~/.cache/huggingface/hub |
✅ 100% Safe | 15 GB – 70 GB |
| Cargo Registry | ~/.cargo/registry/cache |
✅ 100% Safe | 10 GB – 40 GB |
| Gradle Caches | ~/.gradle/caches |
✅ 100% Safe | 10 GB – 35 GB |
Frequently Asked Questions (FAQ)
Will clearing Docker system prune delete my active code or databases?
docker system prune -a --volumes deletes stopped containers, dangling images, and anonymous volumes. If you have active database containers with named persistent volumes you want to preserve, omit the --volumes flag.
Will purging npm or pip caches break existing projects?
No. Package caches only store downloaded archive tarballs. Your existing projects will continue to run normally using their local node_modules or .venv virtual environments.
Related Developer Master Guides
- Step-by-step guide to cleaning Xcode DerivedData.
- Learn about purging Docker ext4.vhdx.
- How to manage npm cache.
Discussion
Loading authentication...