Skip to content

Latest commit

ย 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

mac-cleanup-go

A macOS maintenance tool written in Go that helps identify performance bottlenecks and safely clean long-lived system cruft.

Features

  • Performance-focused maintenance โ€” helps spot what is slowing down your Mac after long-term use
  • Parallel execution โ€” independent tasks fan out as goroutines, results collected via channels
  • Terminal progress UI โ€” live phase updates and per-task summary tables for clarity
  • Safety-first โ€” three hard-coded constraints enforced at the safeDelete() level, not just in comments

Commands

Command Purpose
mac-cleanup overview System dashboard โ€” CPU, Memory, Swap, Disk, Launch Agents, Device Backups, Brew, Docker, top processes
mac-cleanup safe Safe cleanup โ€” caches, logs, Xcode DerivedData, Time Machine thin, diagnostic reports
mac-cleanup deep Deep cleanup โ€” safe + Docker prune + node_modules report + device backup report
mac-cleanup brew Smart Homebrew upgrade โ€” risk-scored, dependency-aware
mac-cleanup brew-analyze Homebrew package audit โ€” duplicates, stale versions, EOL/clashes
mac-cleanup brew-full brew-analyze then brew upgrade in one run
mac-cleanup apps List and cleanly uninstall non-App-Store applications
mac-cleanup help Show detailed usage

Running with no arguments shows the full help screen.

Install

Prerequisites: Go 1.25+, macOS

git clone https://github.com/vianhanif/mac-cleanup-go
cd mac-cleanup-go
go build -o mac-cleanup .

Then add an alias to your shell config (~/.zshrc, ~/.bashrc, etc.):

# mac-cleanup
alias mac-cleanup="/path/to/mac-cleanup-go/mac-cleanup"

# Optional short aliases per command
alias cleanup="mac-cleanup safe"
alias cleanup-deep="mac-cleanup deep"
alias cleanup-overview="mac-cleanup overview"
alias brew-upgrade="mac-cleanup brew"
alias brew-audit="mac-cleanup brew-analyze"

Reload your shell:

source ~/.zshrc

Usage

mac-cleanup <command>

overview

Collects system metrics in parallel and renders three sections โ€” system stats, top home directories, and top processes by CPU.

Add --verbose for expanded diagnostics: top 10 by CPU, top 10 by memory (separate sort), PID + start time + running-for columns, and a zombie/stuck process detector. Strictly read-only โ€” no processes are killed.

mac-cleanup overview            # compact view (top 5 by CPU)
mac-cleanup overview --verbose  # full diagnostic view
๐Ÿ–ฅ  System Dashboard
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ CPU              โ”‚ โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘  58%                                           โ”‚
โ”‚ Memory           โ”‚ โ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘  40%                                           โ”‚
โ”‚ Disk /           โ”‚ โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘  72%  89 GB used of 500 GB                     โ”‚
โ”‚ Brew Outdated    โ”‚ 4 packages                                                โ”‚
โ”‚ Docker           โ”‚ running ยท 2.1 GB reclaimable                              โ”‚
โ”‚ Swap             โ”‚ 2.4 GB used of 8.0 GB                                     โ”‚
โ”‚ Launch Agents    โ”‚ 14 item(s) ยท review in System Settings โ†’ Login Items      โ”‚
โ”‚ Device Backups   โ”‚ 28G ยท 3 backup(s)                                         โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Hostname         โ”‚ alvian-mbp                                                โ”‚
โ”‚ macOS Version    โ”‚ 15.3.2                                                    โ”‚
โ”‚ System Uptime    โ”‚ 3 days                                                    โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

โ”€โ”€ Top Home Directories

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Path             โ”‚ Size     โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ ~/Library        โ”‚ 48 GB    โ”‚
โ”‚ ~/Documents      โ”‚ 12 GB    โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

โ”€โ”€ Top Processes (by CPU)

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Process                  โ”‚   CPU %  โ”‚    Memory โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Xcode                    โ”‚   42.1%  โ”‚    1.8 GB โ”‚
โ”‚ Google Chrome Helper     โ”‚   18.3%  โ”‚   512 MB  โ”‚
โ”‚ coreaudiod               โ”‚    9.2%  โ”‚    48 MB  โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

With --verbose, the process section expands to three panels with PID, start time, and duration columns:

โ”€โ”€ Top Processes (by CPU) โ€” verbose

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ PID   โ”‚ PROCESS                         โ”‚ CPU % โ”‚ MEMORY โ”‚ STARTED      โ”‚ RUNNING FOR โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ 280   โ”‚ com.manageengine.appctrl.driver โ”‚ 89.3% โ”‚  11 MB โ”‚ Apr 8, 13:50 โ”‚      1d 23h โ”‚
โ”‚ 67261 โ”‚ WindowServer                    โ”‚ 16.8% โ”‚  46 MB โ”‚ Apr 9, 16:16 โ”‚     20h 46m โ”‚
โ”‚ 162   โ”‚ trustd                          โ”‚ 10.1% โ”‚   7 MB โ”‚ Apr 8, 13:50 โ”‚      1d 23h โ”‚
โ”‚ 68174 โ”‚ stable                          โ”‚  4.5% โ”‚  98 MB โ”‚  Today 08:26 โ”‚      4h 35m โ”‚
โ”‚ 68242 โ”‚ CursorUIViewService             โ”‚  3.7% โ”‚  12 MB โ”‚  Today 08:26 โ”‚      4h 35m โ”‚
โ”‚ 68361 โ”‚ Lark                            โ”‚  1.8% โ”‚  86 MB โ”‚  Today 08:26 โ”‚      4h 35m โ”‚
โ”‚ 77424 โ”‚ Lark Helper (Renderer)          โ”‚  1.7% โ”‚ 228 MB โ”‚  Today 11:16 โ”‚      1h 46m โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

โ”€โ”€ Top Processes (by Memory) โ€” verbose

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ PID   โ”‚ PROCESS                         โ”‚ CPU % โ”‚ MEMORY โ”‚ STARTED      โ”‚ RUNNING FOR โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ 86502 โ”‚ Code Helper (Plugin)            โ”‚  0.1% โ”‚ 544 MB โ”‚  Today 12:30 โ”‚     32m 27s โ”‚
โ”‚ 86312 โ”‚ Code Helper (Renderer)          โ”‚  0.0% โ”‚ 426 MB โ”‚  Today 12:29 โ”‚      33m 7s โ”‚
โ”‚ 285   โ”‚ mds_stores                      โ”‚  0.0% โ”‚ 322 MB โ”‚ Apr 8, 13:50 โ”‚      1d 23h โ”‚
โ”‚ 77424 โ”‚ Lark Helper (Renderer)          โ”‚  1.7% โ”‚ 228 MB โ”‚  Today 11:16 โ”‚      1h 46m โ”‚
โ”‚ 68173 โ”‚ Google Chrome                   โ”‚  1.0% โ”‚ 169 MB โ”‚  Today 08:26 โ”‚      4h 35m โ”‚
โ”‚ 86308 โ”‚ Code                            โ”‚  0.9% โ”‚ 148 MB โ”‚  Today 12:29 โ”‚      33m 8s โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

โ”€โ”€ Zombie / Stuck Processes

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ PID   โ”‚ PROCESS   โ”‚ STATE  โ”‚ MEMORY โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ 90463 โ”‚ <defunct> โ”‚ zombie โ”‚    0 B โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
  โ„น  Zombie/stuck processes are not killed automatically.
  โ„น  Use Activity Monitor to investigate and force-quit if needed.

safe

Cleans in parallel, then shows a summary table.

๐Ÿงน macOS Maintenance  ยท safe
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

  Cleaning  4 / 5  [โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘]  2s
    User Caches              โœ“  843 MB freed          0.4s
    User Logs                โœ“   12 MB freed          0.1s
    Xcode DerivedData        โœ“  2.1 GB freed          0.2s
    TM Snapshots             โœ“  thinned               1.8s
    Diagnostic Reports       โœ“  18 file(s) removed    0.1s

โ”€โ”€ Summary
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Task                 โ”‚ Status โ”‚ Result                โ”‚ Time   โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ User Caches          โ”‚   โœ“    โ”‚ 843 MB freed          โ”‚ 0.4s   โ”‚
โ”‚ User Logs            โ”‚   โœ“    โ”‚  12 MB freed          โ”‚ 0.1s   โ”‚
โ”‚ Xcode DerivedData    โ”‚   โœ“    โ”‚ 2.1 GB freed          โ”‚ 0.2s   โ”‚
โ”‚ TM Snapshots         โ”‚   โœ“    โ”‚ thinned               โ”‚ 1.8s   โ”‚
โ”‚ Diagnostic Reports   โ”‚   โœ“    โ”‚ 18 file(s) removed    โ”‚ 0.1s   โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Total                โ”‚  5/5   โ”‚ 2.96 GB freed         โ”‚        โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

brew

Phase 1 โ€” Analysis (parallel): for each outdated formula, runs brew info, brew deps, brew uses --installed, and checks brew list --pinned.

Risk scoring per package:

Signal Effect
0 dependents (leaf) risk 0 โ†’ auto-upgrade
1โ€“3 dependents risk 1 โ†’ auto-upgrade
4+ dependents risk 2 โ†’ prompt
Major version bump (1.x โ†’ 2.x) +1 risk
keg-only formula โˆ’1 risk
In critical list or pinned hard skip

Phase 2 โ€” Upgrade: auto-risk packages run in parallel goroutines; prompted packages pause the progress bar and ask [y/N].

๐Ÿบ Smart Brew Upgrade
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

  4 outdated packages found

  Analysing packages  4 / 4  [โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ]  1s
    jq          1.7.0 -> 1.7.1    leaf -> auto-upgrade
    wget        1.24.5 -> 1.25.0  leaf -> auto-upgrade
    libpng      1.6.43 -> 1.6.44  4 dependents - will prompt
    node        20.0 -> 22.0      critical runtime - skipping

  Upgrading  2 / 2  [โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ]  3s
    jq          -> 1.7.1   (0.4s)
    wget        -> 1.25.0  (0.8s)

  ! libpng has 4 dependent(s):
    Dependents: cairo, ffmpeg, imagemagick, libvips
    Version:    1.6.43 -> 1.6.44
  Upgrade? [y/N]:

brew-analyze

Runs three analysis passes in parallel:

  1. Duplicates โ€” same binary stem installed from multiple taps
  2. Multi-version โ€” stale pkg@N slots alongside a newer base formula
  3. Clashes / EOL โ€” packages matched against a built-in EOL/shadowing rules table

Results are categorised into auto-removable, prompt, and informational, then offered for action.

๐Ÿ” Brew Package Analysis
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

  Analysing  3 / 3  [โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ]  4s
    Duplicates            0 issue(s) found
    Multi-version slots   2 issue(s) found
    Clashes / EOL         3 issue(s) found

โ”€โ”€ Analysis Results
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Package         โ”‚ Issue            โ”‚ Detail                                    โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ MULTIPLE VERSIONS                                                               โ”‚
โ”‚ node@18         โ”‚ โœ“ auto-remove    โ”‚ node 22 installed; node@18 is a stale slotโ”‚
โ”‚ llvm@16         โ”‚ โš  prompt         โ”‚ required by: spirv-llvm-translator         โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ CLASHES / EOL                                                                   โ”‚
โ”‚ openssl@1.1     โ”‚ โ„น inform         โ”‚ openssl@1.1 EOL Sep 2023 โ†’ openssl@3      โ”‚
โ”‚ node@20         โ”‚ โ„น inform         โ”‚ Node 20 LTS ends Apr 2026                 โ”‚
โ”‚ curl            โ”‚ โ„น inform         โ”‚ Homebrew curl shadows macOS curl in PATH  โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

โ”€โ”€ Recommended Actions

  Auto-removable (no dependents):
    [ ] node@18      brew uninstall node@18

  Needs your decision:
    [ ] llvm@16      required by: spirv-llvm-translator

  Informational (no action taken):
    [i] openssl@1.1  openssl@1.1 EOL Sep 2023 โ†’ openssl@3
    [i] node@20      Node 20 LTS ends Apr 2026
    [i] curl         Homebrew curl shadows macOS curl in PATH

  Apply 1 auto-removable package(s)? [y/N]:

apps

Scans /Applications, /Applications/Utilities/, and ~/Applications for apps that were not installed via the Apple App Store (detected by the absence of a _MASReceipt/receipt bundle). Displays a numbered list sorted alphabetically, lets you pick one or more to remove, confirms once, then deletes the .app bundle plus all associated support files.

Support file locations cleaned per app:

Location Matched by
~/Library/Application Support/ Bundle ID or app name
~/Library/Caches/ Bundle ID or app name
~/Library/Logs/ Bundle ID or app name
~/Library/Preferences/ <BundleID>.plist and variants
~/Library/Containers/ Bundle ID
~/Library/Group Containers/ dirs containing Bundle ID
~/Library/Saved Application State/ <BundleID>.savedState
~/Library/WebKit/ Bundle ID

Flags:

Flag Effect
(none) Interactive select + uninstall (sorted alphabetically)
--list Print the app list only, no prompt
--dry-run Show what would be removed without deleting
--sort-size Sort listing by Total Size descending (largest first)
๐Ÿ“ฆ App Uninstaller
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

  โœ“  42 non-App-Store app(s) found

โ•ญโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ #  โ”‚ Name             โ”‚ Version โ”‚ Total Size โ”‚ Path                            โ”‚
โ”œโ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  1 โ”‚ Alfred 5         โ”‚ 5.5     โ”‚    252 MB  โ”‚ /Applications/Alfred 5.app      โ”‚
โ”‚  2 โ”‚ Bear             โ”‚ 2.4.1   โ”‚     19 MB  โ”‚ /Applications/Bear.app          โ”‚
โ”‚  3 โ”‚ Docker           โ”‚ 4.40.0  โ”‚    4.1 GB  โ”‚ /Applications/Docker.app        โ”‚
โ”‚  4 โ”‚ iTerm            โ”‚ 3.5.10  โ”‚     85 MB  โ”‚ /Applications/iTerm.app         โ”‚
โ”‚  โ€ฆ โ”‚ โ€ฆ                โ”‚ โ€ฆ       โ”‚ โ€ฆ          โ”‚ โ€ฆ                               โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

  Enter app number(s) to uninstall (e.g. 1,3,5  or  all  or  q to quit)
  > 1,4

  !  The following 2 app(s) will be permanently removed:

    โœ—  Alfred 5  (~252 MB)
       /Applications/Alfred 5.app
    โœ—  iTerm  (~85 MB)
       /Applications/iTerm.app

  Confirm uninstall? [y/N]: y

โ”€โ”€ App Uninstall Summary

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ App      โ”‚ Status    โ”‚ Expected โ”‚ Freed  โ”‚ Time   โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Alfred 5 โ”‚ โœ“ removed โ”‚  252 MB  โ”‚ 248 MB โ”‚ 0.31s  โ”‚
โ”‚ iTerm    โ”‚ โœ“ removed โ”‚   85 MB  โ”‚  82 MB โ”‚ 0.12s  โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Total    โ”‚ 2 app(s)  โ”‚  337 MB  โ”‚ 330 MB โ”‚        โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

The Total Size column in the listing is computed at scan time (.app bundle + all support file locations) so you know what to expect before selecting anything. The summary's Expected vs Freed columns show the pre-deletion estimate against the actual bytes removed โ€” small differences are normal due to OS metadata or files released after process termination.

For --dry-run, Freed shows โ€” and only Expected is populated.

Safety Guarantees

These are enforced in code at the safeDelete() level โ€” not just documentation.

Constraint 1 โ€” No slow bootup

LaunchAgents/, StartupItems/, and Fonts/ are in neverTouchPaths and can never be passed to safeDelete().

Constraint 2 โ€” No system crashes

  • Only paths in allowedPathSuffixes (all under ~/Library/) can be deleted
  • No diskutil, fsck, kextcache, or SIP-protected path access
  • tmutil thinlocalsnapshots only โ€” no snapshot deletion, no purge
  • Docker pruned only when docker info confirms it is running
  • Critical packages (node, go, rust, openssl@3, gcc, zshโ€ฆ) are never auto-upgraded

Constraint 3 โ€” No browser login resets

  • ~/Library/Application Support/ is in neverTouchPaths โ€” never touched

  • Cache subdirectories excluded from the caches sweep:

    com.google.Chrome              com.google.Chrome.canary
    org.mozilla.firefox            org.mozilla.nightly
    com.microsoft.edgemac          com.microsoft.edgemac.Beta
    com.brave.Browser              com.brave.Browser.beta
    com.operasoftware.Opera        com.vivaldi.Vivaldi
    com.apple.Safari               com.apple.SafariTechnologyPreview
    com.tinyspeck.slackmacgap
    com.apple.Spotlight            com.apple.metadata
    com.apple.bird                 com.apple.akd
    com.apple.GSSFramework         CloudKit
    com.apple.iCloudDrive
    

What is never auto-deleted

Item Rule
~/Library/Application Support/ neverTouchPaths hard block
~/Library/LaunchAgents/ neverTouchPaths hard block
~/Library/Fonts/ neverTouchPaths hard block
/System/, /usr/, /bin/โ€ฆ neverTouchPaths hard block
Browser cache dirs cacheExclusions list
node_modules/ directories reported only in deep mode, never deleted
iOS/device backups reported only in deep mode, never deleted
Pinned brew packages brew list --pinned checked before any upgrade

Code Structure

mac-cleanup-go/
โ”œโ”€โ”€ main.go          โ€” CLI entry point, signal handler, mode dispatch
โ”œโ”€โ”€ config.go        โ€” all safety constants (allowlist, blocklist, exclusions, EOL rules)
โ”œโ”€โ”€ runner.go        โ€” safeDelete(), runCmd(), bytesAt(), fmtBytes()
โ”œโ”€โ”€ progress.go      โ€” newPW(), phaseMonitor() โ€” animated progress bars
โ”œโ”€โ”€ overview.go      โ€” overview mode, parallel metric collectors
โ”œโ”€โ”€ cleanup.go       โ€” safe + deep modes, parallel task runner
โ”œโ”€โ”€ brew.go          โ€” smart upgrade: risk scoring, auto/prompt/skip
โ”œโ”€โ”€ brew_analyze.go  โ€” 3-pass package audit: duplicates, multi-version, clashes
โ”œโ”€โ”€ apps.go          โ€” non-App-Store app discovery, support-path resolution, uninstall
โ”œโ”€โ”€ apps_prompt.go   โ€” numbered list table, multi-select prompt, confirm dialog
โ”œโ”€โ”€ summary.go       โ€” rounded summary tables + help screen
โ”œโ”€โ”€ go.mod
โ””โ”€โ”€ go.sum

Only one dependency: github.com/jedib0t/go-pretty/v6

About

A macOS maintenance tool written in Go with an animated terminal UI featuring live progress bars and rounded summary tables

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages