# Mole

> macOS CLI (`mo`) that cleans caches, uninstalls apps with leftovers, explores disk usage, runs maintenance tasks, and shows live system stats.

Stars: 73.2k · Language: Shell · License: GPL-3.0 · Categories: System

- Repository: https://github.com/tw93/Mole
- Website: https://mole.fit
- Page: https://www.trmn.sh/tools/mole

## Install

- Homebrew: `brew install mole`
- Script: `curl -fsSL https://raw.githubusercontent.com/tw93/mole/main/install.sh | bash`

## Overview

Mole is a macOS command-line utility, invoked as `mo`, that combines disk cleanup, app uninstallation, disk analysis, system maintenance, and live monitoring in a single terminal binary. It covers the kind of tasks handled by CleanMyMac, AppCleaner, DaisyDisk, and iStat Menus. It requires macOS 12 or newer and runs on both Intel and Apple Silicon. A separate native Mac app exists, but this repository is the CLI only.

Each task is its own subcommand. `mo clean` removes caches, logs, temporary files, developer artifacts (such as npm and pnpm caches), and leftovers from apps that are no longer installed. `mo uninstall` removes an app along with its launch agents, preferences, and other related files, and keeps shared data still used by another installed copy. `mo optimize` runs bounded maintenance such as flushing DNS, refreshing Finder and QuickLook caches, and database optimization, and skips tasks with a stated reason. `mo purge` cleans project build artifacts, and `mo installer` finds and removes installer files.

`mo analyze` is a terminal disk explorer with arrow-key and Vim navigation, filtering, multi-selection, Finder preview, and confirmed moves to Trash. It also has a `--json` mode that reports `scan_status` (`complete`, `partial`, or `unavailable`) for each entry, which suits scripting. `mo status` is a read-only dashboard for CPU, GPU, memory, disk, network, power, and processes.

Because Mole deletes files, the destructive commands support `--dry-run` with optional `--debug` output. Whitelists (`mo clean --whitelist`, `mo optimize --whitelist`) protect chosen caches and tasks. Cleanup activity is logged to `~/Library/Logs/mole/operations.log` and can be viewed with `mo history`. Mole validates paths, skips system-owned locations, and requests administrator access only when needed. It suits Mac users and developers who want to reclaim disk space and monitor their machine from the terminal.

### Installation

```bash
# via Homebrew
brew install mole
```

```bash
# via Script
curl -fsSL https://raw.githubusercontent.com/tw93/mole/main/install.sh | bash
```

![Mole cleanup results](https://media.trmn.sh/cached/7f081b3b38ebfe9b2384218bcd67be279fa6615aa589b6df18111b60a17122f4.png)

## Alternatives

- [m-cli](https://www.trmn.sh/tools/m-cli.md): macOS command-line tool, invoked as `m`, for controlling system functions such as Wi-Fi, Bluetooth, display, dock, disk, firewall and volume from the Terminal. (Shell, 9.9k stars)
- [tmux](https://www.trmn.sh/tools/tmux.md): Terminal multiplexer that creates, manages, and controls multiple terminal sessions from a single screen (C, 50.0k stars)
- [PM2](https://www.trmn.sh/tools/pm2.md): Process manager for Node.js and Bun apps with a built-in cluster-mode load balancer, zero-downtime reload, log management and startup script generation. (JavaScript, 43.3k stars)
- [mpv](https://www.trmn.sh/tools/mpv.md): Free command-line media player supporting many audio/video formats, codecs and subtitle types, with GPU shader-based rendering and optional hardware decoding. (C, 37.6k stars)
- [restic](https://www.trmn.sh/tools/restic.md): Cross-platform backup program with encryption, deduplication, and support for local/cloud storage backends (Go, 36.9k stars)

---

Canonical: https://www.trmn.sh/tools/mole
