A fast, safe CLI tool to recursively find and delete build artifacts and caches across multiple programming ecosystems. Reclaim hundreds of gigabytes of disk space with a single command.
brew tap moinsen-dev/tap
brew install build-cleaner
cargo install build-cleaner
git clone https://github.com/moinsen-dev/build_cleaner
cd build_cleaner
cargo build --release
# Binary is at target/release/build-cleaner
git clone https://github.com/moinsen-dev/build_cleaner
cd build_cleaner
# Install to ~/bin (no sudo required)
make install-local
# Or install to /usr/local/bin (requires sudo)
make install
# See all available targets
make help
# Scan current directory for build artifacts
build-cleaner
# Scan a specific directory
build-cleaner /path/to/projects
# Preview what would be deleted (dry-run)
build-cleaner --dry-run
# Skip confirmation prompts
build-cleaner --yes
# Scan projects AND user caches (AI models, package managers, IDEs)
build-cleaner --user-caches
# Only scan user caches, skip project build artifacts
build-cleaner --cache-only
# Filter by cache category
build-cleaner --cache-only --cache-category ai-ml
build-cleaner --cache-only --cache-category package
build-cleaner --cache-only --cache-category ai-ml --cache-category ide
# Generate a shell script instead of deleting directly
build-cleaner --script cleanup.sh
# Review and edit the script, then run it
chmod +x cleanup.sh
./cleanup.sh
# Launch web dashboard (auto-opens browser)
build-cleaner --serve
# Use a custom port
build-cleaner --serve --port 3000
# Don't auto-open browser
build-cleaner --serve --no-open
The web UI provides:
# Only scan Node.js and Rust projects
build-cleaner --lang node --lang rust
# Only projects not modified in 30+ days
build-cleaner --min-age 30
# Only artifacts larger than 100MB
build-cleaner --min-size 100MB
# Interactive selection mode
build-cleaner --interactive
# Verbose output
build-cleaner --verbose
| Ecosystem | Config File | Artifacts Cleaned |
|---|---|---|
| Node.js | package.json |
node_modules/ |
| Rust | Cargo.toml |
target/ |
| Python | setup.py, pyproject.toml, requirements.txt |
__pycache__/, .venv/, venv/, .tox/, *.egg-info/ |
| Flutter | pubspec.yaml |
build/, .dart_tool/ |
| Java (Maven) | pom.xml |
target/ |
| Java (Gradle) | build.gradle, build.gradle.kts |
build/, .gradle/ |
| C/C++ | CMakeLists.txt, Makefile |
build/, cmake-build-*/ |
| .NET | *.csproj, *.fsproj |
bin/, obj/ |
| Go | go.mod |
(uses go clean -cache) |
| Category | Icon | Examples |
|---|---|---|
| AI/ML | --cache-category ai-ml |
Hugging Face models, Ollama, PyTorch hub, LM Studio |
| Package Managers | --cache-category package |
npm, Yarn, pnpm, Cargo, Gradle, Maven, pip, CocoaPods, RubyGems |
| Development | --cache-category dev |
Xcode DerivedData, Device Support, Archives |
| IDE | --cache-category ide |
JetBrains cache, VSCode cache, VSCode Server |
| Container | --cache-category container |
Docker (uses docker system prune -a) |
$ build-cleaner --user-caches --dry-run ~/work
π Preview of cleanable artifacts (dry-run mode)
1. π¦ my-app (Node.js) β node_modules (245.3 MB)
2. π¦ my-cli (Rust) β target (1.2 GB)
3. π¦ my-flutter-app (Flutter) β build, .dart_tool (156.8 MB)
...
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Summary
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β’ 42 projects with 78 artifact directories
π By ecosystem:
π¦ 15 Flutter 12.4 GB
π¦ 20 Node.js 8.2 GB
π¦ 4 Rust 6.1 GB
π 3 Python 0.3 GB
β’ 12 user caches
ποΈ User caches:
π€ 3 AI/ML 32.1 GB
π¦ 6 Package managers 8.4 GB
π» 2 IDE 1.2 GB
π³ 1 Container 5.8 GB
π Largest items:
π₯ 1. π€ Hugging Face 28.4 GB
π₯ 2. π¦ Ollama models 12.1 GB
π₯ 3. π¦ my-big-project/target 4.2 GB
...
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
πΎ Total space to reclaim: 74.5 GB
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Usage: build-cleaner [OPTIONS] [DIRECTORY]
Arguments:
[DIRECTORY] Directory to scan for projects [default: .]
Options:
-n, --dry-run Preview mode - show what would be deleted
-y, --yes Skip confirmation prompts
-i, --interactive Interactive selection mode
--include <PATTERN> Additional directory patterns to clean
--exclude <PATTERN> Directory patterns to skip
-p, --lang <TYPE> Filter by project type (node, rust, python, flutter, java-maven, java-gradle, cpp, dot-net, go)
--min-age <DAYS> Only projects not modified in N days
--min-size <SIZE> Only artifacts above this size (e.g., "100MB", "1GB")
-v, --verbose Enable verbose output
-u, --user-caches Also scan user-level caches
--cache-only Only scan user caches, skip projects
--cache-category <CATEGORY> Filter cache categories (ai-ml, package, dev, ide, container)
--script <PATH> Generate shell script instead of deleting
--serve Launch web UI dashboard
--port <PORT> Port for web UI server [default: 8080]
--no-open Don't auto-open browser when starting web UI
-h, --help Print help
-V, --version Print version
package.json, Cargo.toml)node_modules/, target/)Dry-run by default awareness: The tool shows a clear summary before any deletion
Confirmation prompts: Unless --yes is specified, you must confirm before deletion
Script generation: Use --script to generate a reviewable script instead of direct deletion
MIT License - see LICENSE for details.
Contributions are welcome! Please feel free to submit a Pull Request.