Mole is a macOS system maintenance CLI tool that provides a unified interface for cleaning caches, uninstalling applications, analyzing disk usage, monitoring system health, and optimizing performance. It combines two Go binaries (cmd/analyze for disk exploration with a Bubble Tea TUI, cmd/status for real-time system metrics) with an extensive shell script library for orchestration and system-level operations. The `mo` command dispatches to subcommands like `clean`, `uninstall`, `analyze`, `status`, `optimize`, `purge`, and `installer`. The architecture is hybrid: Go handles performance-critical tasks (concurrent directory scanning with semaphore-based concurrency, hardlink deduplication, gob-based caching, and interactive TUI rendering) while Bash scripts manage cleanup logic, safety guards (path identity snapshots, whitelists, process guards), Homebrew integration, and sudo session management. Key data flows include disk scanning with progress events and cache invalidation, system metrics collection via gopsutil and macOS commands (system_profiler, ioreg, pmset), and cleanup operations with dry-run previews and bounded timeouts. External dependencies include Homebrew (for cask detection and uninstall), macOS system commands (tmutil, plutil, diskutil, osascript), and Go modules (charmbracelet/bubbletea, lipgloss, gopsutil). The codebase emphasizes safety with fail-closed policies, identity re-verification before deletion, and extensive timeout handling. It supports both interactive TUI and non-interactive JSON output for scripting.
PureMac is a free, open-source macOS system cleaner and app uninstaller built as a native SwiftUI application (targeting macOS 13.0+). It provides a graphical interface and a companion CLI tool for scanning and removing junk files, uninstalling applications with full leftover cleanup, finding orphaned files, and performing scheduled maintenance. The system is architected with an MVVM-like pattern: a central `AppState` ObservableObject drives all UI state, while modular actors (`ScanEngine`, `CleaningEngine`, `BinaryThinner`) handle async scanning and cleaning operations with safety checks (path allowlists, symlink resolution, trash-only deletion). The app uses a 10-level heuristic to match app files, scans 12+ categories (system junk, user cache, Xcode, Homebrew, Docker, AI apps, etc.), and integrates with macOS services like Full Disk Access, Finder Services, Menu Bar, and Sparkle auto-updates. The CLI is a separate Swift package with its own set of commands (clean, purge, analyze, optimize, ignore, config) that reuses similar logic, ensuring consistency between GUI and terminal workflows. The codebase is well-structured, fully internationalized (10+ languages), and distributed via Homebrew and GitHub releases with a full CI/CD pipeline for signing and notarization.