Installation
lu-cleaner is a single Go binary. It installs no daemon, launch agent or background service, and it never asks for sudo. Its configuration file and private application state are created when needed. Update backups live beside the executable.
Requirements
Section titled “Requirements”| Requirement | Details |
|---|---|
| macOS 12 Monterey or later | Apple Silicon or Intel. lu-cleaner is macOS-only: it relies on APFS, getattrlistbulk, xcrun simctl and the macOS layout of ~/Library. |
| Go 1.25 or later | Only needed to build and install the binary. |
| git | Used by the worktree scanner (git worktree list, git worktree remove). Without it, worktrees are simply not scanned. The Xcode Command Line Tools provide it. |
Everything else is optional: Xcode, Android Studio, Docker, Node.js version managers and AI tools are only inspected when they are installed.
Install with go install
Section titled “Install with go install”This is the recommended way:
go install github.com/ludwig-pro/lu-cleaner/cmd/lu-cleaner@latestGo places the binary in $(go env GOPATH)/bin, which is usually ~/go/bin (or in $GOBIN if you set it). If your shell cannot find lu-cleaner afterwards, add that folder to your PATH:
echo 'export PATH="$PATH:$(go env GOPATH)/bin"' >> ~/.zshrcsource ~/.zshrcCheck the installation:
lu-cleaner versionBuild from source
Section titled “Build from source”Use this to try an unreleased change or to contribute.
-
Clone the repository:
Terminal window git clone https://github.com/ludwig-pro/lu-cleaner.gitcd lu-cleaner -
Build
bin/lu-cleaner. The version is taken fromgit describe:Terminal window make build./bin/lu-cleaner scan --summary -
Install it into
$(go env GOPATH)/bin:Terminal window make install
make run ARGS="scan --summary" builds and runs in one step, and make test runs the unit tests. See Contributing for the development workflow.
Add a short alias
Section titled “Add a short alias”lu-cleaner is long to type. make install suggests luc:
echo 'alias luc=lu-cleaner' >> ~/.zshrcsource ~/.zshrcluc scan --summaryThe rest of this documentation spells out lu-cleaner in full.
Grant Full Disk Access (optional)
Section titled “Grant Full Disk Access (optional)”macOS privacy protection (TCC) prevents any app from reading a few folders unless you grant it Full Disk Access. lu-cleaner works without it, but a few folders are then out of reach:
| Folder | Without Full Disk Access |
|---|---|
~/.Trash |
The Trash is listed as Trash (size unknown — needs Full Disk Access). Cleaning it asks Finder to empty it instead of deleting the files directly (Finder may ask you for an Automation permission). lu-cleaner doctor reports the Trash size as unknown. |
~/Library/Application Support/MobileSync/Backup |
iPhone and iPad backups made by Finder are listed as iPhone/iPad backups (size unknown). They are report-only either way: lu-cleaner never deletes device backups. |
Other apps' containers: ~/Library/Containers/<app>, ~/Library/Group Containers/<group> |
Never read, measured or cleaned. On macOS 14 and later, touching them would open a system permission prompt and block the scan until someone answers. Catalog entries stored there (Docker Desktop logs, the Microsoft Teams cache, the Apple Music artwork cache…) are listed as report-only with the warning needs Full Disk Access, the Docker Desktop and OrbStack disk images are not shown, and analyze shows these folders as 🔒 app container — needs Full Disk Access. |
lu-cleaner analyze also warns when some entries are unreadable and their sizes are partial.
To grant it:
- Open System Settings → Privacy & Security → Full Disk Access.
- Enable the app you run lu-cleaner from: Terminal, iTerm2, Ghostty, Warp, or the editor whose integrated terminal you use. Add it with + if it is not listed.
- Quit and reopen that app so the permission applies.
Update
Section titled “Update”The dashboard and interactive clean, artifacts, worktrees, devices and analyze commands check GitHub for a newer stable release at most once every rolling 24 hours. The check runs after optional diagnostic consent. The release lookup times out after 1.5 seconds. An offline failure consumes that day's check and your command continues normally.
Installation always asks [y/N]. Enter, no, invalid input or EOF declines. --yes authorizes cleaning only. Reports such as scan and doctor, --list, --dry-run, --json, redirected streams, CI and root execution skip checks. To opt out:
LU_NO_UPDATE=1 lu-cleanerExport LU_NO_UPDATE=1 in your shell configuration to keep checks disabled. Any nonempty value disables checks.
Direct release binaries and stable tagged go install binaries are supported when their executable and directory belong to you and have safe permissions. The prompt warns that updating a go install binary replaces it with the precompiled GitHub release. Unknown development builds, prereleases, symlinks and package-managed paths are skipped. You can continue using your original installation method.
The updater downloads only the official release archive and its checksums.txt, verifies SHA-256, and validates the universal macOS executable before installation. This verifies integrity against the release account, not an independent publisher signature. Downloads are limited to 60 seconds. Failures before replacement leave the executable intact; cleanup still runs.
Before replacing the executable atomically, lu-cleaner creates a unique, verified .lu-cleaner-backup-* in the same directory. Its exact path is printed after success. The current invocation continues with its original version. The next invocation runs the new version. Backups are never removed automatically. If directory synchronization fails after replacement, the updater reports that the update is installed with uncertain durability and keeps the backup. It does not overwrite the installed executable with an automatic rollback.
The check timestamp and cross-process locks live in $XDG_STATE_HOME/lu-cleaner/update, or ~/.local/state/lu-cleaner/update by default. They contain no release cache, executable path or credential. Two lu-cleaner processes coordinate checks and installations. Other programs running as your user can still change your writable executable between its final check and replacement.
To update manually with Go, run the same installation command again:
go install github.com/ludwig-pro/lu-cleaner/cmd/lu-cleaner@latestFrom a clone, pull and reinstall:
git pullmake installYour configuration and history are kept.
Restore a backup
Section titled “Restore a backup”Close other lu-cleaner invocations. Replace these two paths with the exact backup path printed after the update and the executable path shown in its confirmation. These commands copy the backup to a temporary sibling, then replace the executable atomically. They preserve the backup.
backup="/exact/path/.lu-cleaner-backup-printed-suffix"target="/exact/path/lu-cleaner"staged="$(mktemp "${target}.restore.XXXXXX")"cp "$backup" "$staged" && chmod 755 "$staged" && mv -f "$staged" "$target"Run lu-cleaner version to verify the restored version. Manage retained backups explicitly when you no longer need them.
Uninstall
Section titled “Uninstall”Before removing the binary, check where your files live. The configuration moves if you set LU_CLEANER_CONFIG or XDG_CONFIG_HOME, the history if you set XDG_STATE_HOME:
lu-cleaner config path # the configuration filelu-cleaner config show # also prints the history fileThen remove the binary, the configuration and the history:
rm "$(command -v lu-cleaner)"rm -rf ~/.config/lu-cleaner # config.toml, if you created onerm -rf ~/.local/state/lu-cleaner # history and private application stateFinally, delete the alias luc=lu-cleaner line from ~/.zshrc if you added it. Review any retained .lu-cleaner-backup-* beside the executable separately.