luthebao

Personal site of luthebao

View project on GitHub

mac-cli is a multi-purpose command-line tool for macOS, written in Odin. It bundles several utilities I reach for daily — disk cleaning, image/video optimisation, and screenshots — behind one small, agent-friendly binary. Currently ships an Apple Silicon (arm64) build only.

Source and releases live at github.com/luthebao/mac-cli.

Install

One-liner — pulls the latest release binary, no Odin toolchain required:

curl -fsSL https://raw.githubusercontent.com/luthebao/mac-cli/main/install.sh | bash

The script downloads the latest tarball, picks a sensible install dir (/usr/local/bin if writable, otherwise ~/.local/bin), strips the macOS quarantine xattr so Gatekeeper doesn’t block the first run, and prints a PATH hint if the chosen dir isn’t already on $PATH.

Self-update

The binary updates itself — same install logic, no flags needed:

mac-cli update            # install latest if newer
mac-cli update --check    # report only; exits non-zero when update available
mac-cli update --force    # re-run the installer even if already current

Commands

clean — disk cleaner

mac-cli clean                        # interactive cleaner
mac-cli clean --risky                # include risky categories
mac-cli clean categories             # list all 16 cleanable categories
mac-cli clean uninstall              # remove apps + their leftovers
mac-cli clean maintenance --dns      # flush DNS cache
mac-cli clean backup --list          # list pre-delete backups

clop — image & video optimiser

mac-cli clop                         # interactive picker
mac-cli clop -o photo.png            # optimise in place
mac-cli clop -o ~/Pictures -r        # recurse into a directory
mac-cli clop -d 50% clip.mp4         # downscale by factor
mac-cli clop -c webp cover.png       # convert image format
mac-cli clop -s IMG_2156.jpg         # strip EXIF metadata

Shells out to format-specific CLIs (pngquant, jpegoptim, gifsicle, ffmpeg, vips, cwebp, heif-enc, exiftool). Missing tools trigger an interactive brew install prompt on first use. Supported formats: .png .jpg .jpeg .gif (images) and .mp4 .mov .m4v (videos).

shot — screenshots

mac-cli shot                         # interactive picker (type to filter)
mac-cli shot -s                      # capture full screen
mac-cli shot -l                      # list running GUI apps with PIDs
mac-cli shot -p 1234                 # capture a specific app by PID

All screenshots land in ~/Desktop as PNGs. First run may prompt for the Screen Recording permission in System Settings → Privacy.

Claude Code agent skill

If you use Claude Code, install the companion agent skill so Claude can drive mac-cli for you — cleaning caches, taking app-specific screenshots, optimising media, and so on:

npx skills add luthebao/mac-cli

The skill assumes the mac-cli binary is already on $PATH, so install that first.

Build from source

git clone https://github.com/luthebao/mac-cli.git
cd mac-cli
make build                           # → build/mac-cli
make test
make install

Licensed under MIT.