You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: undo StableBar's changes when Homebrew uninstalls it - #898
brew uninstall --cask stablebar only removed the app. A bar that was running kept running from the deleted bundle, and the menu bar's auto-hide, Open at login, the Accessibility and Automation permissions, /usr/local/bin/stablebar and the Keychain items stayed. --zap only added the files on its trash list. Fixes#896.
This is stacked on #894 (Settings → Uninstall, #848), whose uninstall steps it reuses. The cask change is stablebox/homebrew-tap#3.
What Homebrew allows
From Homebrew 7.0.15's source (cask/artifact/abstract_uninstall.rb, cask/installer.rb, cask/upgrade.rb), checked in a VM:
A cask's uninstall stanza also runs for brew upgrade (the old version's stanza, with --greedy for this auto_updates cask) and for brew reinstall, and a script can't tell which called it. login_item: is skipped on upgrade and reinstall. quit: runs on all three, and brew reopens the app after an upgrade. Scripts run as the user.
zap runs only with --zap. Homebrew 7.0.10 and later run zap scripts before removing the app; earlier versions run them after.
brew uninstall uses the uninstall steps recorded when the cask was installed, not the tap's current cask.
So the cask can't simply run StableBar --uninstall --yes: that would reset the permissions and preferences on every upgrade.
Options
Cask only (quit, login_item, plus a zap script for tccutil and the Keychain). Plain brew uninstall would still leave auto-hide on: the menu bar stays hidden with no bar in its place. It would also leave the permissions, the command and the Keychain items.
Chosen: decide after brew exits. The uninstall script starts a helper that waits until brew exits, then checks whether StableBar is still installed. It acts only when StableBar is gone, so an upgrade or a reinstall changes nothing. Plain brew uninstall then matches Settings' Uninstall, which keeps ~/.config/stablebar, and --zap also trashes that folder. This works the same on any Homebrew version.
Changes
--homebrew-uninstall (internal, run by the cask): copies the app to ~/Library/Caches/StableBar uninstall <UUID>, because Homebrew is about to delete it and the steps need a whole bundle (Open at login, preferences). It starts the copy with --finish-homebrew-uninstall <brew pid> <app path> [--show-menu-bar] and returns at once. It never fails brew. It reads the auto-hide record here, because --zap trashes the preferences before the helper runs.
--finish-homebrew-uninstall: waits for brew's process to exit (polling every 500 ms), then checks whether the app is back or the Caskroom still lists stablebar. If either is true, it deletes its copy and exits. Otherwise it opens the copy through Launch Services, so StableBar's own System Events permission turns off auto-hide; started from brew, macOS would ask whether Terminal may control System Events. The copy then runs Settings' steps minus moving the app, and an alert lists any step that failed.
The copy lives in Caches, not a temporary folder: Launch Services ignores apps there, and tccutil reset then fails with No such bundle identifier (-10814).
Uninstall's files step ran removePersistentDomain, which made cfprefsd write an empty org.stablebar.app.plist seconds later. That happened even after StableBar had quit, and even after --zap had trashed the file. It now runs defaults delete, which writes that file at once, and then deletes the file. Settings' Uninstall gets this too.
Docs: Uninstall in getting-started.md and the "How do I uninstall StableBar?" answer, plus its copy in HelpQuestion.swift. Older installs keep the old cask's steps and need brew reinstall --cask stablebar once.
Testing
swift test for HomebrewUninstallTests (new: argument parsing, the still-installed check, which folder gets removed, the steps after Homebrew), UninstallTests, HelpQuestionTests and ArchitectureRulesTests. scripts/check.sh --quick and npx commitlint --from origin/main pass.
tart VM (macOS 26.6, Homebrew 7.0.12), with setup done using Replace the menu bar and Open at login. The VM also had /usr/local/bin/stablebar, a StableBar Keychain item, and the Accessibility and Automation permissions. The tap's cask was this PR's cask, pointing at a branch build. Each case started from a fresh clone. State 40 s after brew, once BTM had dropped the disabled login item:
Before (0.18.0, current cask): brew uninstall --cask stablebar with the bar running
--zap trashed the config, caches and preferences, and left everything else above, including the running bar.
After: brew uninstall --cask stablebar with the bar running
==> Uninstalling Cask stablebar
==> Quitting application 'org.stablebar.app'...
Application 'org.stablebar.app' quit successfully.
==> Running uninstall script /bin/sh
Once Homebrew is done, StableBar undoes what it changed on this Mac, unless Homebrew installs it again.
==> Backing up App 'StableBar.app' to '/opt/homebrew/Caskroom/stablebar/0.19.0/StableBar.app'
==> Removing App '/Applications/StableBar.app'
==> Purging files for version 0.19.0 of Cask stablebar
== auto-hide (_HIHideMenuBar): 0
== processes: none
== app: missing
== preferences plist: missing
== caches: (none)
== config: ~/.config/stablebar
== command: missing
== keychain: none
== login item: (none)
== TCC (user): (none)
== TCC (system): (none)
== copy folders left: 0
macOS asked once for the administrator password to remove the command (the same prompt as Settings). Run from Terminal.app, there was no Terminal → System Events prompt.
After: --zap, and with the bar not running
brew uninstall --zap --cask stablebar gave the same state, with config: missing. The Trash held only brew's trash list. Without a running bar, brew skipped the quit, and the state matched the running case.
==> Upgrading stablebar
==> Quitting application 'org.stablebar.app'...
==> Running uninstall script /bin/sh
Once Homebrew is done, StableBar undoes what it changed on this Mac, unless Homebrew installs it again.
==> Removing App '/Applications/StableBar.app'
==> Moving App 'StableBar.app' to '/Applications/StableBar.app'
🍺 stablebar was successfully upgraded!
==> Reopening 1 application closed during upgrade:
org.stablebar.app
== auto-hide (_HIHideMenuBar): 1
== processes: 1270 /Applications/StableBar.app/Contents/MacOS/StableBar
== preferences plist: setupCompleted = 1; turnedOnMenuBarAutoHide = 1;
== command: /usr/local/bin/stablebar
== keychain: present
== login item: Disposition: [enabled, allowed, notified]
== TCC (user): kTCCServiceAppleEvents|2
== TCC (system): kTCCServiceAccessibility|2
== copy folders left: 0
Reinstall kept the same state. Homebrew doesn't reopen apps after a reinstall, so the bar stayed quit.
Not checked: a notarized release build. The VM ran ad-hoc-signed branch builds, whose quarantine I removed after brew installed them.
Merging
Rebase merge or merge commit: the two fix commits give a patch release, and the docs commit releases nothing. Merge after #894. If #894's branch is deleted first, retarget this to main.
Merge stablebox/homebrew-tap#3 after the first stable release that includes this. Before then, the cask would run an app without --homebrew-uninstall, which prints its usage and changes nothing. The docs say "before 0.19.0"; adjust that if this ships in another version.
brew uninstall --cask stablebar only removed the app: a bar that was running kept running, and
the menu bar's auto-hide, Open at login, permissions, the stablebar command and Keychain items
stayed. The cask's uninstall script now runs --homebrew-uninstall. Homebrew runs that script to
upgrade and reinstall too, without saying which, so it copies the app to ~/Library/Caches and
starts the copy, which waits for brew to exit. When StableBar is still installed then, it only
deletes itself. Otherwise Launch Services opens it, so it controls System Events with
StableBar's own permission, and it does what Settings' Uninstall does, except moving the app.
Refs #896
Removing the preferences domain left an empty property list in ~/Library/Preferences, which
UserDefaults writes seconds later, even after StableBar has quit. It also came back after brew
uninstall --zap had trashed the file. defaults delete writes that file at once, so Uninstall now
runs it and then deletes the file.
brew uninstall --cask stablebar now undoes StableBar's changes once Homebrew is done, and keeps
everything on an upgrade or a reinstall. Homebrew keeps the uninstall steps of the cask that
installed StableBar, so an install from before 0.19.0 needs brew reinstall first.
No actionable comments were generated in the recent review.
Walkthrough
StableBar adds a Homebrew uninstall command that copies the app and starts a finisher. After Homebrew exits, the finisher checks whether StableBar remains installed and may run uninstall steps. The changes also update uninstall reporting, tests, and Homebrew uninstall documentation.
Changes: Homebrew uninstall flow
Layer / File(s)
Summary
Homebrew command and app handoff Sources/StableBar/App/LaunchCommand.swift, Sources/StableBar/App/StableBarApp.swift, Sources/StableBar/App/HomebrewUninstall.swift, Tests/StableBarTests/HomebrewUninstallTests.swift
The new commands parse Homebrew uninstall requests and dispatch them to HomebrewUninstall. The start path copies the app to a restricted cache folder and launches a detached finisher. Tests cover command parsing and invalid arguments.
The finisher waits for Homebrew when given its PID and checks whether the app or a cask installation remains. If neither remains, it runs uninstall steps without moving the app. Uninstall reporting and preference removal are updated. Tests cover installed-state detection, copy-folder identification, and remaining uninstall steps. The FAQ and guides describe Homebrew uninstall and zap behavior.
Possibly related issues
stablebox/StableBar#848: The PR reuses uninstall steps for Homebrew-triggered cleanup, which addresses the uninstall-and-undo behavior described in the issue.
Possibly related PRs
stablebox/StableBar#894: It changes the uninstall step flow that this PR reuses for Homebrew-triggered cleanup.
Severity of issue fixed: Medium
Merge Risk: Minimal · up to 55841
This change makes Homebrew uninstall undo StableBar's system changes while leaving upgrades and reinstalls alone. No concrete merge-blocking issue was found in the supplied changes. A notarized release build has not been checked.
Security architecture risk: Moderate · up to 55841
Deferred cleanup can overlap a subsequent installation and remove saved tokens, permissions or preferences that the new installation still needs. The impact is contained to StableBar’s local state. Ordinary upgrades and reinstalls are protected by an installed-state check, and privileged command removal still requires administrator approval.
Retained concerns
Medium · reliability · inferred: The detached finisher does not preserve installation ownership throughout cleanup. After its final installed-state check, asynchronous steps can pause while a separate installation starts. Cleanup then continues against shared StableBar state, potentially deleting tokens, resetting permissions and removing preferences used by that installation. Waiting for the initiating Homebrew process and checking again after Launch Services handoff protect ordinary upgrade/reinstall execution, but do not protect an installation beginning after the last check.
Security review details
Security Blast Radius
observed — The cleanup targets local StableBar state: user caches and preferences, bundle-identifier-scoped permissions, login registration, marked command scripts and Keychain items under the StableBar service. Keychain deletion spans matching package/source accounts, not one configuration. Protected command removal retains an administrator prompt.
Trust Boundaries and Controls
observed — The new CLI accepts caller-controlled timing and installation-check inputs, but the app-path argument is not a deletion target. Copy removal derives from the running bundle’s parent and requires the designated prefix. Existing explicit uninstall already exposed the shared cleanup operations; the inspected changes do not establish a remote caller or automatic privilege elevation.
Resilience and Maintainability Implications
inferred — Copy cleanup depends on the finisher reaching a terminal path. Interruption or a successful launch handoff followed by failure before cleanup can leave the copied executable behind. The private cache directory contains this retention; it does not itself establish additional privilege or credential access.
Hardening Proposals
proposed — Coordinate installer and finisher ownership across the complete cleanup transition, and prevent a stale finisher from continuing against a later installation. A single additional presence check would narrow, but not eliminate, the race across asynchronous cleanup steps.
Pre-merge checks: 2 · 1
Failed checks: 1 inconclusive
Check name
Status
Explanation
Resolution
Linked Issues check
Issue #896 asks that brew uninstall --cask stablebar undo StableBar's system changes, that --zap also remove ~/.config/stablebar, and that upgrades and reinstalls keep state.
App-side evidence …
Provide the diff or review evidence for stablebox/homebrew-tap#3, including its uninstall and zap stanzas, and confirm that it calls --homebrew-uninstall with the expected arguments. With that evidence, the Homebrew entry point and th…
Passed checks: 2 passed
Check name
Status
Explanation
Description check
The description follows the repository template closely. It has Problem (with Fixes #896), Changes, Testing, and Merging sections, and it ends with the model and harness line ("Claude Opus 5.5 via Cla…
Out of Scope Changes check
Changes introduced by #898 (against merge base 2afedbb) map to issue #896 or its documentation: - HomebrewUninstall.swift, LaunchCommand.swift and StableBarApp.swift add the internal `--homebrew…
Full details: Description check
Explanation
The description follows the repository template closely. It has Problem (with Fixes #896), Changes, Testing, and Merging sections, and it ends with the model and harness line ("Claude Opus 5.5 via Claude Code"). The Problem section explains the gap and links the issue. The Changes section lists each area and why it is needed. The Testing section gives swift test results, the lint commands, and VM before/after state captures, and it names what was not checked (a notarized release build). The Merging section states the merge method, the dependency on #894 and the cask PR ordering, and the release effect. No required section is missing.
Full details: Out of Scope Changes check
Explanation
Changes introduced by #898 (against merge base 2afedbb) map to issue #896 or its documentation:
HomebrewUninstall.swift, LaunchCommand.swift and StableBarApp.swift add the internal --homebrew-uninstall and --finish-homebrew-uninstall entry points. These implement the deferred cleanup.
Uninstall.swift changes preference cleanup to defaults delete plus plist removal. The issue requires that Homebrew uninstall leave preferences in the Settings-equivalent state. The change also applies to Settings' Uninstall, which shares these steps. It is a justified shared-step change.
Uninstall.notRun and UninstallSystem.report report steps not run after a failed quit. This supports the alert required by the helper path.
HomebrewUninstallTests.swift covers the new code.
docs/getting-started.md, docs/questions.md and HelpQuestion.swift document the new Homebrew uninstall behavior and the required reinstall for older installs.
No unrelated change was found in the supplied summary.
Full details: Linked Issues check
Explanation
Issue #896 asks that brew uninstall --cask stablebar undo StableBar's system changes, that --zap also remove ~/.config/stablebar, and that upgrades and reinstalls keep state.
App-side evidence in this PR (#898, stacked on reviewed #894):
HomebrewUninstall.start() copies the app to a Caches folder and starts --finish-homebrew-uninstall with brew's PID. It returns 0 and does not fail brew.
finish() waits for brew to exit. It removes its copy and stops if the app path or a Caskroom stablebar record remains. This covers upgrade and reinstall.
Otherwise it runs Settings' uninstall steps without moving the app. Plain uninstall keeps ~/.config/stablebar.
Uninstall.swift replaces removePersistentDomain with defaults delete and then deletes the plist. This prevents the empty plist from reappearing.
UninstallFlow and UninstallController (#894, reviewed) supply the Settings steps that this path reuses.
Unverified evidence:
The trigger is the cask uninstall and zap stanzas in fix: undo StableBar's changes on brew uninstall homebrew-tap#3. That repository is not in the stack review evidence and its diff was not supplied. Without it, the Homebrew entry point, the --zap path and the upgrade or reinstall invocation cannot be confirmed in code.
The author's VM results cover uninstall, --zap, upgrade and reinstall on macOS 26.6 with Homebrew 7.0.12. These are prior observations and not reviewed code evidence.
Notarized release builds were not checked.
Stack status per objective:
Plain uninstall undoes auto-hide, Open at login, permissions, command and Keychain: Uncertain. App-side steps are present. The cask trigger is unreviewed.
--zap removes configuration: Uncertain for the same reason.
Upgrades and reinstalls keep state: Uncertain. The app-side installed-state guard is present. The cask invocation is unreviewed.
No objective is shown to be unmet. No objective is fully addressed by reviewed evidence.
Resolution
Provide the diff or review evidence for stablebox/homebrew-tap#3, including its uninstall and zap stanzas, and confirm that it calls --homebrew-uninstall with the expected arguments. With that evidence, the Homebrew entry point and the upgrade and reinstall behavior can be assessed.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Reviewing files that changed from the base of the PR and between 6559778 and 5584143.
Files selected for processing: 3
Sources/StableBar/App/HomebrewUninstall.swift
Sources/StableBar/App/Uninstall.swift
Tests/StableBarTests/HomebrewUninstallTests.swift
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
…StableBar
When another StableBar wouldn't quit, the steps after Homebrew stopped there, and the alert
listed only the quit, saying to uninstall again, which Homebrew's removal of the app no longer
allows. The alert now also lists each step that didn't run, with what to do by hand.
On CodeRabbit's retained concern, a failed quit dropping the skipped steps: fixed in 5584143. When another StableBar won't quit, the helper's alert now also lists every step that didn't run, each with what to do by hand, because Homebrew has already removed the app and "uninstall again" isn't possible. The helper still deletes its copy, so it doesn't stay in ~/Library/Caches. The alert is the recovery path, as for Settings' --finish-uninstall. The rule stays that nothing is reset while another StableBar runs.
On CodeRabbit's new retained concern, an install starting during cleanup: I'm leaving this as is. The helper's last installed check runs after brew exits and again after the Launch Services handoff. That covers upgrades, reinstalls and failed uninstalls, which all run in the same brew process. The only way to race it is to run brew install within the few seconds the steps take after an uninstall. What it removes then is the old install's state: tokens, permissions and preferences that Uninstall exists to remove, the same as Settings' Uninstall followed by a quick reinstall. At worst the fresh install opens setup again. Re-checking before every step wouldn't close the race either, only narrow it.
## [0.19.0](v0.18.0...v0.19.0) (2026-11-25)
### Features
* add a Quick toggles widget, a Control Center-style panel of switches and tools by @Seb-GRAF ([d949a89](d949a89))
* add KiwiDesk as a workspace source by @M4n0x ([0da5d89](0da5d89))
* change the whole look in Appearance and set the bar's margin per axis ([#926](#926)) by @Seb-GRAF ([82156aa](82156aa))
* control each app's sound, the input device and music from the Sound widget by @Seb-GRAF ([186d7db](186d7db))
* describe KiwiDesk workspaces and list KiwiDesk with the other window managers by @M4n0x ([1149849](1149849))
* follow KiwiDesk's events and switch Spaces from workspace widgets by @M4n0x ([383e2de](383e2de))
* give setup and the starter only widgets and displays Get Widgets and Settings offer ([#916](#916)) by @Seb-GRAF ([217ae14](217ae14))
* let a popup control what plays in any app, with the timeline and 15-second skips by @Seb-GRAF ([3abe2da](3abe2da))
* list only the window managers found on this Mac in Settings by @M4n0x ([2137f5d](2137f5d))
* post your bar's image and link to social networks, and draw its glass as on screen ([#922](#922)) by @Seb-GRAF ([099250d](099250d))
* read KiwiDesk's Spaces and windows for workspace widgets by @M4n0x ([e633cba](e633cba))
* replace the included themes and rebuild setup around them by @Seb-GRAF ([e30dc67](e30dc67))
* set the space between the icons Menu bar items shows on the bar by @Seb-GRAF ([00fa4ce](00fa4ce))
### Bug Fixes
* address CodeRabbit's review of the sound controls by @Seb-GRAF ([0ac54f8](0ac54f8))
* address cubic's review of the tooltip slider by @M4n0x ([8523b0f](8523b0f))
* address the review of the sound controls by @Seb-GRAF ([40db99c](40db99c))
* don't restart workspaces for a launch seen just before they stopped by @M4n0x ([d52aa6a](d52aa6a))
* draw live menu bar items without the menu bar's opaque background by @Seb-GRAF ([815faec](815faec))
* draw StableBar's bundled icon in Share My Bar and every other view by @M4n0x ([805e945](805e945)), closes [#895](#895)
* drop the earlier starter's bar sizes so each theme draws with its own by @Seb-GRAF ([5dafa75](5dafa75))
* keep a growing popup from flashing a scroll bar by @M4n0x ([edb3344](edb3344)), closes [#883](#883)
* keep a themed slider in a hover tooltip to a line of text by @M4n0x ([d56519b](d56519b)), closes [#880](#880)
* keep a tooltip whose controls draw nothing from crashing by @M4n0x ([2c080aa](2c080aa))
* keep each package's widgets on that package's own templates ([#824](#824)) by @Jonathanm10 ([05c7252](05c7252)), closes [#805](#805)
* keep the icon's 512-pixel bitmap as its image's only representation by @M4n0x ([d876411](d876411)), closes [#895](#895)
* leave out a slider's ticks unless they stand 6 points apart by @M4n0x ([25cc3cd](25cc3cd))
* leave out a slider's ticks when its steps would run together by @M4n0x ([c9d487b](c9d487b))
* leave StableBar's own mixer devices out of the Sound widget's device lists by @Seb-GRAF ([db1d7b3](db1d7b3))
* let a mouse click answer the Location prompt from the Quick toggles ([#918](#918)) by @Seb-GRAF ([6b9117f](6b9117f))
* move a plain slider one step per arrow key, and keep its ticks before macOS 26 by @M4n0x ([b54212d](b54212d))
* open SwiftUI menu bar panels from the bar on macOS 27 by @M4n0x ([50fae9e](50fae9e)), closes [#798](#798)
* plan the Mac's real uninstall steps in Settings and quit once they're done by @M4n0x ([6d67a44](6d67a44))
* queue now-playing commands with the widget's other actions by @Seb-GRAF ([e5365b9](e5365b9))
* reconnect workspaces at once when a menu bar window manager launches by @M4n0x ([76771ef](76771ef))
* rescan window managers once the login shell's PATH arrives by @M4n0x ([cba21b2](cba21b2))
* share a stuck window manager lookup and queue a rescan that comes mid-scan by @M4n0x ([c86e372](c86e372))
* stop an app's tap after the queued work when one of its plans fails by @Seb-GRAF ([b894cb7](b894cb7))
* take the icon's 512-pixel bitmap from the file rather than through AppKit by @M4n0x ([bfac648](bfac648)), closes [#895](#895)
* turn on Sound's details after its click was set to nothing, and qualify the docs by @Seb-GRAF ([4263bec](4263bec))
* turn on Sound's details popup in setup, the starter and earlier bars by @Seb-GRAF ([5e1a8ef](5e1a8ef))
* undo StableBar's changes when Homebrew uninstalls it ([#898](#898)) by @M4n0x ([bb90c02](bb90c02)), closes [#896](#896)
* wrap a scene's hover tooltip at the live tooltip's width by @M4n0x ([82818ce](82818ce))
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deep-reviewCodeRabbit reviews this pull request: big or risky changesreleased
1 participant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
brew uninstall --cask stablebaronly removed the app. A bar that was running kept running from the deleted bundle, and the menu bar's auto-hide, Open at login, the Accessibility and Automation permissions,/usr/local/bin/stablebarand the Keychain items stayed.--zaponly added the files on its trash list. Fixes #896.This is stacked on #894 (Settings → Uninstall, #848), whose uninstall steps it reuses. The cask change is stablebox/homebrew-tap#3.
What Homebrew allows
From Homebrew 7.0.15's source (
cask/artifact/abstract_uninstall.rb,cask/installer.rb,cask/upgrade.rb), checked in a VM:uninstallstanza also runs forbrew upgrade(the old version's stanza, with--greedyfor thisauto_updatescask) and forbrew reinstall, and a script can't tell which called it.login_item:is skipped on upgrade and reinstall.quit:runs on all three, and brew reopens the app after an upgrade. Scripts run as the user.zapruns only with--zap. Homebrew 7.0.10 and later runzapscripts before removing the app; earlier versions run them after.brew uninstalluses the uninstall steps recorded when the cask was installed, not the tap's current cask.So the cask can't simply run
StableBar --uninstall --yes: that would reset the permissions and preferences on every upgrade.Options
quit,login_item, plus azapscript fortccutiland the Keychain). Plainbrew uninstallwould still leave auto-hide on: the menu bar stays hidden with no bar in its place. It would also leave the permissions, the command and the Keychain items.--uninstall --yesfromzap(Run StableBar's uninstall when zapping homebrew-tap#1). Covers--zaponly, and only from Homebrew 7.0.10.uninstallscript starts a helper that waits untilbrewexits, then checks whether StableBar is still installed. It acts only when StableBar is gone, so an upgrade or a reinstall changes nothing. Plainbrew uninstallthen matches Settings' Uninstall, which keeps~/.config/stablebar, and--zapalso trashes that folder. This works the same on any Homebrew version.Changes
--homebrew-uninstall(internal, run by the cask): copies the app to~/Library/Caches/StableBar uninstall <UUID>, because Homebrew is about to delete it and the steps need a whole bundle (Open at login, preferences). It starts the copy with--finish-homebrew-uninstall <brew pid> <app path> [--show-menu-bar]and returns at once. It never failsbrew. It reads the auto-hide record here, because--zaptrashes the preferences before the helper runs.--finish-homebrew-uninstall: waits for brew's process to exit (polling every 500 ms), then checks whether the app is back or the Caskroom still listsstablebar. If either is true, it deletes its copy and exits. Otherwise it opens the copy through Launch Services, so StableBar's own System Events permission turns off auto-hide; started from brew, macOS would ask whether Terminal may control System Events. The copy then runs Settings' steps minus moving the app, and an alert lists any step that failed.tccutil resetthen fails withNo such bundle identifier(-10814).removePersistentDomain, which made cfprefsd write an emptyorg.stablebar.app.plistseconds later. That happened even after StableBar had quit, and even after--zaphad trashed the file. It now runsdefaults delete, which writes that file at once, and then deletes the file. Settings' Uninstall gets this too.getting-started.mdand the "How do I uninstall StableBar?" answer, plus its copy inHelpQuestion.swift. Older installs keep the old cask's steps and needbrew reinstall --cask stablebaronce.Testing
swift testforHomebrewUninstallTests(new: argument parsing, the still-installed check, which folder gets removed, the steps after Homebrew),UninstallTests,HelpQuestionTestsandArchitectureRulesTests.scripts/check.sh --quickandnpx commitlint --from origin/mainpass./usr/local/bin/stablebar, aStableBarKeychain item, and the Accessibility and Automation permissions. The tap's cask was this PR's cask, pointing at a branch build. Each case started from a fresh clone. State 40 s after brew, once BTM had dropped the disabled login item:Before (0.18.0, current cask):
brew uninstall --cask stablebarwith the bar running--zaptrashed the config, caches and preferences, and left everything else above, including the running bar.After:
brew uninstall --cask stablebarwith the bar runningmacOS asked once for the administrator password to remove the command (the same prompt as Settings). Run from Terminal.app, there was no Terminal → System Events prompt.
After:
--zap, and with the bar not runningbrew uninstall --zap --cask stablebargave the same state, withconfig: missing. The Trash held only brew's trash list. Without a running bar, brew skipped the quit, and the state matched the running case.After:
brew upgrade --cask --greedy stablebar(0.19.0 → 0.19.1) andbrew reinstall --cask stablebarReinstall kept the same state. Homebrew doesn't reopen apps after a reinstall, so the bar stayed quit.
Not checked: a notarized release build. The VM ran ad-hoc-signed branch builds, whose quarantine I removed after brew installed them.
Merging
Rebase merge or merge commit: the two
fixcommits give a patch release, and thedocscommit releases nothing. Merge after #894. If #894's branch is deleted first, retarget this tomain.Merge stablebox/homebrew-tap#3 after the first stable release that includes this. Before then, the cask would run an app without
--homebrew-uninstall, which prints its usage and changes nothing. The docs say "before 0.19.0"; adjust that if this ships in another version.Claude Opus 5.5 via Claude Code