MacLean CLI: cleanup your disk from the terminal
The CLI shares the MacLean cleanup engine but is free forever, needs no account and no license server. Every command previews by default; nothing is deleted until you pass --yes.
Install
Three supported paths. Homebrew and cargo install the latest tagged release; the script builds from source.
Homebrew (recommended)
brew install jamesfeng2009/maclean/maclean Installs the latest tagged release. Recent Homebrew versions ask you to trust third-party taps once: brew trust jamesfeng2009/maclean.
Cargo (crates.io)
cargo install maclean-cli Builds the published crate with your local Rust toolchain. Requires Rust 1.80+.
From source
./scripts/install-cli.sh
# or: ./scripts/install-cli.sh --system Builds the workspace and installs to ~/.local/bin (or /usr/local/bin with --system, needs sudo).
Quick start
Scan, preview, then delete — in that order. The preview output labels every item by what happens if it is removed.
1. See what is cleanable
maclean scan Read-only scan. Shows sizes and the rebuild cost of each category.
2. Preview, delete nothing
maclean clean --tab dev-cache --dry-run Prints the exact paths that would be removed. Safe to run anywhere, including production machines.
3. Execute
maclean clean --tab dev-cache --yes Must pass --yes explicitly; in non-interactive environments the CLI refuses to delete without it.
4. Disk report
maclean check-disk --breakdown --json Category breakdown of disk usage in a stable, machine-readable shape.
Command reference
Run maclean <command> --help for the full flag list. Global output flags: --format human|json|jsonl, --json.
| Command | What it does | Key flags |
|---|---|---|
scan | Scan for cleanable items without deleting anything. | read-only |
clean | Preview and delete reclaimable items. | --tab, --safe-only, --dry-run, --yes, --scheduled, --privileged |
check-disk | Disk usage per category. | --breakdown, --json |
list | List every scan category the CLI knows about. | — |
apps | Installed applications, including Chrome/Safari PWAs. | — |
uninstall <APP> | Remove an app plus its caches and support data; moves to Trash. | — |
startup | Manage LaunchAgents and LaunchDaemons. | <COMMAND> |
schedule | Show, register or remove scheduled cleanups. | — |
optimize | System maintenance tasks. | <COMMAND> |
backups | List past deletion manifests. | — |
restore <ID> | Restore files from a previous deletion manifest. | — |
log | Print the log file path or the latest lines. | — |
dup-ignore | Maintain the ignore list for duplicate-file scans. | <COMMAND> |
Automation
Structured output is a stable contract: field names do not change with translations.
Cron / CI: only safe items, machine-readable
maclean clean --safe-only --yes --scheduled --format json --scheduled records the run time, so the GUI can show when the last scheduled cleanup happened.
Stream results line by line
maclean clean --tab dev-cache --yes --format jsonl | jq -c 'select(.event=="deleted")' jsonl emits one JSON object per line — pipe into jq, a log collector or a monitoring agent.
Uninstall and undo
maclean apps
maclean uninstall Slack
maclean backups
maclean restore <ID> App bundles and associated data go to the Trash; restore works from a deletion manifest.
Safety rules built into the CLI
- Dry run is the default — deletion requires an explicit --yes.
- Caches are deleted permanently; large files go to the Trash first.
- Protected applications are intercepted and require separate confirmation.
- Every deletion writes a manifest, so backups and restore can bring files back.
- No account, no telemetry of file contents; the CLI works fully offline.
Scope note
Pro commands (history, growth, forecast, policy, automation) are contract placeholders in the CLI. They parse and return a structured error — the implementations live in the paid GUI edition. The CLI itself never requires a license.
Related
- Download the CLI Prebuilt binaries and checksums.
- Safety model How deletion stays reversible.
- Documentation Architecture, contracts and contributing.
- Source code ↗ Apache-2.0, issues and releases.