Skip to content

fix(doctor): detect browsers installed via Nix, Home Manager, or PATH#1567

Closed
vibecrypto wants to merge 1 commit into
danielmiessler:mainfrom
vibecrypto:fix/doctor-nix-chrome-detection
Closed

fix(doctor): detect browsers installed via Nix, Home Manager, or PATH#1567
vibecrypto wants to merge 1 commit into
danielmiessler:mainfrom
vibecrypto:fix/doctor-nix-chrome-detection

Conversation

@vibecrypto

Copy link
Copy Markdown

Problem

Doctor.ts's chromeBinary() only probes legacy install locations:

  • /Applications/Google Chrome.app / /Applications/Brave Browser.app
  • /usr/bin/google-chrome, /usr/bin/chromium, /usr/bin/chromium-browser

On machines where the browser is installed declaratively — nix-darwin / Home Manager put GUI apps under /Applications/Nix Apps/ and expose the binary on PATH (e.g. /run/current-system/sw/bin/google-chrome) — none of these candidates exist, so Doctor reports:

✗ Browser verification (Interceptor) — broken
  no Chrome/Brave/Chromium binary found

…even though Chrome is installed and fully working. The cached "broken" verdict (7-day TTL in capabilities.json) then steers sessions into declaring Interceptor unusable and suggesting a redundant Chrome install.

Fix

Two additions to chromeBinary(), no behavior change on machines where the current paths already match:

  1. Add the /Applications/Nix Apps/ locations for Chrome and Brave to the candidate list.
  2. Fall back to a PATH lookup via a small whichPath() helper (like the existing which(), but returning the resolved path — the probe's detail string does browser.split('/'), so the fallback must yield a string, not a boolean). Covers google-chrome, chromium, brave, and brave-browser — the last also fixes the Linux-Brave false negative reported in Six bugs found during a fresh 7.1.1 install (TELOS parser, Doctor.ts, hook wiring, timezone default) #1496 (item 3), which was closed without the fix landing: /usr/bin is on PATH, so the lookup finds /usr/bin/brave-browser without more hardcoded candidates.

Testing

On a nix-darwin machine with Chrome installed via Home Manager (/Applications/Nix Apps/Google Chrome.app, binary on PATH):

  • Before: ✗ Browser verification (Interceptor) — broken — no Chrome/Brave/Chromium binary found
  • After: ✅ Browser verification (Interceptor) — live — skill present, browser found (Google Chrome)

Unchanged on a machine with a standard /Applications/Google Chrome.app install (first candidate still wins).

chromeBinary() only probed legacy install paths (/Applications and
/usr/bin), so on machines where the browser is installed declaratively
(nix-darwin / Home Manager), Doctor reported the Interceptor capability
as 'broken — no Chrome/Brave/Chromium binary found' even though Chrome
was installed and on PATH.

Add the '/Applications/Nix Apps/' locations and fall back to a PATH
lookup via the existing which() helper. The fallback includes
'brave-browser', which also fixes the Linux-Brave false negative
reported in danielmiessler#1496 (item 3). No behavior change on machines where the
current candidate paths already match.
@danielmiessler

Copy link
Copy Markdown
Owner

Ported with credit. The /usr/bin/brave-browser candidates from #1496 were already in source; your Nix Apps paths and PATH fallback close the rest — and the whichPath() string-not-boolean detail was a nice catch. (Closing rather than merging: the public repo is generated from private source; the port ships in the next release.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants