# Mole — Terminal Cleanup and Optimization Toolkit for macOS > Open-source macOS maintenance CLI that cleans, uninstalls, analyzes, optimizes, and monitors your Mac from the terminal. ## Install Save as a script file and run: # Mole — Terminal Cleanup and Optimization Toolkit for macOS ## Quick Use ```bash # Install via Homebrew brew install tw93/tap/mole # Scan for junk files mole clean # Uninstall an app completely mole uninstall AppName # Show disk usage analysis mole analyze ``` ## Introduction Mole is an open-source command-line tool by tw93 that brings macOS system maintenance into the terminal. It replaces GUI utilities like CleanMyMac, DaisyDisk, and iStat Menus with a single lightweight binary, giving developers full control over cleanup, monitoring, and optimization without leaving their workflow. ## What Mole Does - Scans and removes system junk, caches, logs, and leftover files to reclaim disk space - Fully uninstalls applications including preferences, containers, and support files - Analyzes disk usage with an interactive visual breakdown in the terminal - Monitors CPU, memory, disk, and network usage in real time - Optimizes system performance by clearing inactive memory and DNS caches ## Architecture Overview Mole is written as a collection of shell scripts orchestrated by a central dispatcher. Each subcommand (clean, uninstall, analyze, optimize, monitor) is a standalone module that uses native macOS utilities like mdfind, lsof, and system_profiler under the hood. This keeps the binary small and dependency-free while leveraging the operating system's own APIs for accurate results. ## Self-Hosting & Configuration - Install via Homebrew with `brew install tw93/tap/mole` - Alternatively clone the repo and run `make install` for manual setup - Configuration is stored in `~/.config/mole/config.toml` for custom scan paths - Supports exclusion lists to skip specific directories or apps during cleanup - Works on macOS 12 Monterey and later with both Intel and Apple Silicon ## Key Features - Single binary with zero external dependencies beyond macOS system tools - Interactive terminal UI for disk analysis with color-coded size indicators - Safe uninstall mode that previews files before deletion - Real-time system monitor as a lightweight alternative to Activity Monitor - Extensible subcommand architecture for adding custom maintenance scripts ## Comparison with Similar Tools - **CleanMyMac** — commercial GUI app with subscription pricing; Mole is free and terminal-native - **DaisyDisk** — excellent disk visualizer but GUI-only; Mole provides terminal-based analysis - **AppCleaner** — uninstalls apps but limited to drag-and-drop; Mole handles CLI batch operations - **iStat Menus** — system monitor in the menu bar; Mole provides similar data in the terminal - **ncdu** — disk usage analyzer for any Unix; Mole adds macOS-specific cleanup and uninstall ## FAQ **Q: Does Mole work on Linux?** A: No, Mole is designed specifically for macOS and relies on macOS-native system APIs and utilities. **Q: Is it safe to run mole clean on a production machine?** A: Mole targets caches, logs, and temporary files that are safe to remove. It always shows a preview before deleting, and you can add exclusions for sensitive paths. **Q: How does Mole compare to running manual terminal commands?** A: Mole aggregates dozens of cleanup and analysis commands into simple subcommands, saving time and reducing the chance of accidentally deleting important files. **Q: Can Mole schedule automated cleanups?** A: Mole itself does not include a scheduler, but you can invoke it from cron or launchd for recurring maintenance. ## Sources - https://github.com/tw93/Mole - https://tw93.fun/ --- Source: https://tokrepo.com/en/workflows/asset-6f7d42b5 Author: Script Depot