Skip to content
Agentmart
Submit a tool

brew-cleanup

Reclaim Homebrew disk by removing old formula/cask versions, pruning the download cache, and uninstalling orphaned dependencies (brew autoremove).

Skill by lexfrei

IndexedBSD-3-Clause★ 11
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/lexfrei-brew-cleanup

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Reclaim Homebrew disk by removing old formula/cask versions, pruning the download cache, and uninstalling orphaned dependencies (brew autoremove). Shows a dry-run estimate first, then runs the user-chosen scope after approval. TRIGGER when the user wants to free Homebrew space ("brew cleanup", "почисти brew", "remove orphaned brew packages"). DO NOT trigger for uninstalling a specific named formula.

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/brew-cleanup

What's inside

Skill name
brew-cleanup
Description
Reclaim Homebrew disk by removing old formula/cask versions, pruning the download cache, and uninstalling orphaned dependencies (brew autoremove). Shows a dry-run estimate first, then runs the user-chosen scope after approval. TRIGGER when the user wants to free Homebrew space ("brew cleanup", "почисти brew", "remove orphaned brew packages"). DO NOT trigger for uninstalling a specific named formula.
License
BSD-3-Clause
Instructions
55 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

Reclaim Homebrew disk space, then report what was freed.

Operates in **report → confirm → execute** order. The scope is chosen through an interactive question, not flags. After approval, run the cleanup autonomously.

## Step 1: Check Homebrew

```bash
command -v brew >/dev/null 2>&1
```

If `brew` is not installed, stop and say so. Otherwise note the cache location: `brew --cache`.

## Step 2: Dry-run report

Gather what each scope would do, without changing anything:

```bash
brew autoremove -n   # orphaned dependencies that would be uninstalled
brew cleanup -n      # old versions + stale cache; prints "This operation would free approximately N"
```

Report the orphan list from `autoremove -n` and the freed-space estimate from `cleanup -n`. Record baseline sizes of **every** location these scopes touch — not just the cache. `brew cleanup` removes old versions from the Cellar/Caskroom, and `brew autoremove` uninstalls formulae from the Cellar with little or no cache impact, so a cache-only measurement under-reports (and reads as 0 for autoremove). Capture all three:

```bash
du -sh "$(brew --cache)" "$(brew --cellar)" "$(brew --prefix)/Caskroom" 2>/dev/null
```

## Step 3: Ask what to run (interactive)

Explain each scope, then **ask the user** (interactive, multi-select) which to run:

- **Remove old versions + stale cache** — `brew cleanup`: deletes superseded versions of installed formulae/casks and cache older than the default retention. Safe; nothing currently installed is removed.
- **Uninstall orphaned dependencies** — `brew autoremove`: uninstalls formulae that were pulled in only as dependencies and are no longer required by anything. Review the dry-run list — a formula you use directly but never `brew install`ed explicitly would be removed (re-install with `brew install <name>` if needed).
- **Scrub the entire download cache** — `brew cleanup --prune=all`: also removes the latest cached downloads, not just stale ones. Frees more; the next `brew install`/upgrade re-downloads.

## Step 4: Execute (after approval)

Run the selected actions. If **autoremove** is selected, run it first, so the freshly-orphaned versions are then swept by the cleanup pass:

```bash
brew autoremove
```

For the cleanup pass, use the full-scrub variant if the user selected it, otherwise the standard one — selecting both the standard cleanup and the full scrub collapses to a single `--prune=all` run:

```bash
brew cleanup              # standard: old versions + stale cache
brew cleanup --prune=all  # full scrub: also removes the latest cached downloads
```

## Step 5: Report

Re-measure the same locations recorded in Step 2 — cache, Cellar, and Caskroom — and report the space reclaimed from the before/after delta, not the cache alone (old-version removal and `autoremove` free Cellar/Caskroom space with little or no cache impact). Prefer any explicit freed-space figure brew prints. List the formulae uninstalled by `autoremove` (if run) and what was kept.

From lexfrei/ccc, BSD-3-Clause.

More from lexfrei/ccc

Signals

Stars
11
Forks
3
Open issues
2
Last commit (this folder)
Jun 3, 2026 (4 months ago)
Last release
Oct 4, 2026 (24 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
BSD-3-Clause
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from lexfrei

Cite this page

brew-cleanup skill. Agent Mart. https://agentmart.dev/skills/lexfrei-brew-cleanup (last updated 2026-10-24)