Skip to content

[Brew] Uninstall a tap's packages before removing it on every Homebrew version - #31853

Merged
raycastbot merged 7 commits into
raycast:mainfrom
chrismessina:ext/brew
Oct 4, 2026
Merged

raycastbot merged 7 commits into
raycast:mainfrom
chrismessina:ext/brew

Conversation

@chrismessina

@chrismessina chrismessina commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes Remove Tap on older Homebrew 6 releases (reported by Cursor Bugbot on #31820), plus two follow-ups Bugbot and Greptile found in the fix itself.

When a tap still has installed packages, Remove Tap confirms that they will be uninstalled first, and it ran brew untap --force. That flag uninstalls the tap's formulae and casks first only from Homebrew 6.0.13 (Homebrew commit c1feb84ef4, 2026-07-23, cmd/untap.rb). On 6.0.0–6.0.12, which this extension still supports, --force meant "untap even though packages are installed" and left them behind with no tap.

Remove Tap now runs the steps itself, the same on every version:

  1. HOMEBREW_NO_AUTOREMOVE=1 brew uninstall --cask <user/repo/token…> (casks first, since a cask can depend on a formula)
  2. HOMEBREW_NO_AUTOREMOVE=1 brew uninstall --formula <user/repo/name…>
  3. brew untap <user/repo>, with no --force

The run stops at the first failure, so if Homebrew refuses to uninstall a package (another package depends on it, say), the tap is kept and the failure toast says why. The confirmation text is unchanged and is now true on every version.

Autoremove is off for the uninstalls, as it is inside untap --force (neither cmd/untap.rb nor uninstall.rb autoremoves). Left on, uninstalling the casks removes the tap's formulae that were installed only as their dependencies, the formula step then fails on a package already gone, and the tap stays (Bugbot, below).

untapCommands in src/utils/brew/taps.ts builds the commands and has five new unit tests. The behavior and the version boundary are written up in AGENTS.md.

After a Remove Tap that stops partway (the casks uninstalled, a formula then refused), the list now refreshes whenever a command ran, not only on full success, so trying again starts at the step that failed instead of the casks that are already gone (Greptile, below).

A progress-toast fix was in an earlier revision of this PR and has been taken out; it will come back separately. 417 unit tests; tsc, ray lint and ray build are clean.

Checklist


Note

Medium Risk
Changes destructive Remove Tap behavior across Homebrew versions; logic is explicit and tested, but failed or partial uninstalls still affect real packages and tap state.

Overview
Remove Tap no longer relies on brew untap --force, which on Homebrew 6.0.0–6.0.12 could remove the tap while leaving its packages installed despite the confirmation text. It now runs an explicit sequence via new untapCommands: uninstall tap casks, then formulae (with HOMEBREW_NO_AUTOREMOVE=1), then a plain brew untap, stopping on the first failure so a refused uninstall keeps the tap.

Manage Taps tracks installed tap packages as TapInstalls (formulae vs casks) for that flow, uses multi-step labeling (stepNoun), and refreshes the list after any started run (Add Tap and Remove Tap), not only full success—so a partial remove can be retried without re-attempting already removed casks.

Adds unit tests for untapCommands and updates AGENTS.md, CHANGELOG, and TODO.md (documents the toast finish-in-place follow-up separately from this fix).

Reviewed by Cursor Bugbot for commit 89cf641. Bugbot is set up for automated code reviews on this repo. Configure here.

- Merge branch \'contributions/merge-1790979343010\' into feature/third-party-taps
- Pull contributions
- Merge branch \'fix/untap-uninstall\' of /Users/messina/Developer/GitHub/chrismessina/brew into feature/third-party-taps
- fix(taps): uninstall a tap\'s packages explicitly before untapping
@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: brew Issues related to the brew extension platform: macOS OP is contributor The OP of the PR is a contributor of the extension labels Oct 2, 2026
@raycastbot

Copy link
Copy Markdown
Collaborator

Thank you for your contribution! 🎉

🔔 @nhojb @Aayush9029 @mathieudutour @urwrstkn8mare @ashokbaruaakas @MillerApps @pernielsentikaer @jfkisafk @vpukhanov @j3lte @alexander-cato @ViGeng @ridemountainpig @clins1994 @alexibuild you might want to have a look.

You can use this guide to learn how to check out the Pull Request locally in order to test it.

📋 Quick checkout commands
BRANCH="ext/brew"
FORK_URL="https://github.com/chrismessina/extensions.git"
EXTENSION_NAME="brew"
REPO_NAME="extensions"

git clone -n --depth=1 --filter=tree:0 -b $BRANCH $FORK_URL
cd $REPO_NAME
git sparse-checkout set --no-cone "extensions/$EXTENSION_NAME"
git checkout
cd "extensions/$EXTENSION_NAME"
npm install && npm run dev

We're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 15 business days.

@chrismessina chrismessina changed the title Update brew extension [Brew] Uninstall a tap's packages before removing it on every Homebrew version Oct 2, 2026

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread extensions/brew/src/utils/brew/taps.ts Resolved
- Merge branch \'fix/untap-uninstall\' of /Users/messina/Developer/GitHub/chrismessina/brew into feature/third-party-taps
- fix: progress toast overwriting its own result; untap without autoremove
@chrismessina chrismessina changed the title [Brew] Uninstall a tap's packages before removing it on every Homebrew version [Brew] Remove Tap on every Homebrew version, and a stuck progress toast Oct 2, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d2315ee. Configure here.

Comment thread extensions/brew/src/utils/toast.ts Resolved
- Merge branch \'fix/untap-uninstall\' of /Users/messina/Developer/GitHub/chrismessina/brew into feature/third-party-taps
- fix(toast): ignore Cancel once the action has finished
@greptile-apps

greptile-apps Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium risk] Changes how the Homebrew tap removal command works.

The code changes appear safe to merge once the changelog heading follows the repository’s merge-date requirement.

Findings

  1. P2 Release date stays fixed ▶
Fix with agent prompt
### Issue 1
extensions/brew/CHANGELOG.md:3
The new `CHANGELOG.md` heading uses `2026-10-04` instead of the required `{PR_MERGE_DATE}`. The merge workflow skips entries without that placeholder. If this PR merges on another day, users will see the wrong release date. Restore the placeholder before merging.

```suggestion
## [Remove Tap fix] - {PR_MERGE_DATE}
```

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Remove Tap now uninstalls a tap’s casks and formulae before removing it, including on Homebrew versions where untap --force left packages behind. Add and Remove Tap also refresh their lists after a command starts, so partial changes show up on the next attempt.

  • The uninstall steps run casks first, disable autoremove, and stop at the first failure.
  • Tests and project notes cover the removal steps, partial refreshes, and a separate toast follow-up.

Reviews (5) · Last reviewed commit: "Update CHANGELOG.md"

@greptile-apps

This comment has been minimized.

- Merge branch \'fix/untap-uninstall\' of /Users/messina/Developer/GitHub/chrismessina/brew into feature/third-party-taps
- fix(taps): refresh the list after any attempted add or remove
@chrismessina

Copy link
Copy Markdown
Contributor Author

@greptile Fixed in e1c70b2 (Remove Tap retries get stuck). untap and addTap in manage-taps.tsx now refresh the list whenever a command ran, using confirmAndRun's beforeRun hook, not only on full success. After a partial Remove Tap the installed list no longer includes the uninstalled casks, so a retry starts at the formula that failed.

@greptile-apps

greptile-apps Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

The fix addresses the retry path. beforeRun runs only after confirmation and immediately before the first command, so started is set only when the sequence actually begins. untap then calls onDone() whenever the sequence started, including when a later command fails.

After a successful cask uninstall followed by a formula failure, onChange() revalidates the installed-package list and removes the cask from the retry inputs. The next attempt can therefore start with the formula that failed instead of repeating the already-successful cask uninstall. The analogous addTap refresh also covers a tap added before a later trust step fails.

Comment thread extensions/brew/src/utils/toast.ts Resolved
- Merge branch \'fix/untap-uninstall\' of /Users/messina/Developer/GitHub/chrismessina/brew into feature/third-party-taps
- fix(toast): send hides at once, never after the settle gap
- Merge branch \'fix/untap-uninstall\' of /Users/messina/Developer/GitHub/chrismessina/brew into feature/third-party-taps
- revert(toast): take the settle-gap toast changes out of this PR
@chrismessina chrismessina changed the title [Brew] Remove Tap on every Homebrew version, and a stuck progress toast [Brew] Uninstall a tap's packages before removing it on every Homebrew version Oct 3, 2026
@chrismessina
chrismessina marked this pull request as ready for review October 3, 2026 17:11
@chrismessina chrismessina mentioned this pull request Oct 3, 2026
5 tasks done
@0xdhrv 0xdhrv self-assigned this Oct 4, 2026

@0xdhrv 0xdhrv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, approved ✅

@raycastbot
raycastbot merged commit 97f2b1a into raycast:main Oct 4, 2026
2 checks passed
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

@raycastbot

Copy link
Copy Markdown
Collaborator

🎉 🎉 🎉

We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag.

@@ -1,5 +1,10 @@
# Brew Changelog

## [Remove Tap fix] - 2026-10-04

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Release date stays fixed

The new CHANGELOG.md heading uses 2026-10-04 instead of the required {PR_MERGE_DATE}. The merge workflow skips entries without that placeholder. If this PR merges on another day, users will see the wrong release date. Restore the placeholder before merging.

Suggested change
## [Remove Tap fix] - 2026-10-04
## [Remove Tap fix] - {PR_MERGE_DATE}

Rule Used: What: Changelog entries must use {PR_MERGE_DATE} placeholder in titles, be placed at the top of the file, and maintain descending version order. Why: Standardized placeholders and consistent ordering ensure changelogs are maintainable and merge da... (source)

Knowledge Base Used: Contributor validation tooling

Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/brew/CHANGELOG.md
Line: 3

Comment:
**Release date stays fixed**

The new `CHANGELOG.md` heading uses `2026-10-04` instead of the required `{PR_MERGE_DATE}`. The merge workflow skips entries without that placeholder. If this PR merges on another day, users will see the wrong release date. Restore the placeholder before merging.

```suggestion
## [Remove Tap fix] - {PR_MERGE_DATE}
```

**Rule Used:** What: Changelog entries must use `{PR_MERGE_DATE}` placeholder in titles, be placed at the top of the file, and maintain descending version order.  Why: Standardized placeholders and consistent ordering ensure changelogs are maintainable and merge da... ([source](https://app.greptile.com/raycast/-/custom-context?memory=c2214c11-df56-490a-b1c0-09a385df481a))

**Knowledge Base Used:** [Contributor validation tooling](https://app.greptile.com/raycast/-/custom-context/knowledge-base/raycast/extensions/-/docs/contributor-validation-tooling.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

@chrismessina
chrismessina deleted the ext/brew branch November 15, 2026 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extension: brew Issues related to the brew extension extension fix / improvement Label for PRs with extension's fix improvements OP is contributor The OP of the PR is a contributor of the extension platform: macOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants