diff --git a/crates/agentplug-host/src/browser.rs b/crates/agentplug-host/src/browser.rs index 7a46a51..0ae114d 100644 --- a/crates/agentplug-host/src/browser.rs +++ b/crates/agentplug-host/src/browser.rs @@ -120,12 +120,37 @@ fn which(cmd: &str) -> Option { }) } +/// Live-found (chrome-discovery-misses-macos): this list only ever checked +/// `/usr/bin/google-chrome`+chromium (Linux) or the Windows Program Files +/// paths -- a standard macOS install at +/// `/Applications/Google Chrome.app/Contents/MacOS/Google Chrome` was never +/// a candidate, so `find_chrome()` fell straight through to the `which()` +/// PATH lookup below, which fails too (installing Chrome.app does not put +/// anything on PATH), and every browser dispatch on an otherwise-correctly- +/// provisioned Mac failed with "no Chrome found; install Google Chrome or +/// Chromium". Fixed by adding the standard system-wide and per-user +/// macOS app-bundle paths (plus Chromium.app for parity with the Linux +/// chromium fallback) as additional candidates -- the existing Linux/ +/// Windows/PATH checks are untouched since this same binary is built and +/// run on those platforms too. fn find_chrome() -> Option { let candidates = if cfg!(windows) { vec![ PathBuf::from(r"C:\Program Files\Google\Chrome\Application\chrome.exe"), PathBuf::from(r"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"), ] + } else if cfg!(target_os = "macos") { + let mut v = vec![ + PathBuf::from("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"), + PathBuf::from("/Applications/Chromium.app/Contents/MacOS/Chromium"), + ]; + if let Some(home) = std::env::var_os("HOME") { + v.push( + PathBuf::from(home) + .join("Applications/Google Chrome.app/Contents/MacOS/Google Chrome"), + ); + } + v } else { vec![ PathBuf::from("/usr/bin/google-chrome"), @@ -184,10 +209,13 @@ fn parse_body(body: &str) -> (Option, String) { /// `capture\n