Summary
On macOS, detectDefaultChromiumExecutableMac() correctly reads the system default browser bundle ID from LaunchServices (e.g. com.microsoft.edgemac), but the subsequent osascript-based path resolution silently fails, causing a fallback to the hardcoded candidate list which starts with Chrome.
Repro
- Set Microsoft Edge as your macOS default browser (System Settings → Desktop & Dock → Default web browser)
- Start OpenClaw with no
browser.executablePath override
- Run
openclaw browser status
Expected: detectedBrowser: edge, detectedPath: /Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge
Actual: detectedBrowser: chrome, detectedPath: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
Root Cause
In detectDefaultChromiumExecutableMac():
const appPathRaw = execText('/usr/bin/osascript', ['-e', `POSIX path of (path to application id "${bundleId}")`]);
if (!appPathRaw) return null; // ← silently returns null
const exeName = execText('/usr/bin/defaults', ['read', path.join(appPath, 'Contents', 'Info'), 'CFBundleExecutable']);
if (!exeName) return null; // ← or here
The osascript call uses com.microsoft.edgemac (the LaunchServices bundle ID), but this may not match the bundle ID registered in Edge's Info.plist (com.microsoft.Edge), causing the lookup to fail. When either call returns null, the function returns null and the code falls through to the hardcoded fallback list (Chrome first).
Suggested Fix
Add a fallback path resolution map for known bundle IDs before giving up:
const KNOWN_BUNDLE_ID_PATHS: Record<string, string> = {
'com.microsoft.edgemac': '/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge',
'com.microsoft.edgemac.beta': '/Applications/Microsoft Edge Beta.app/Contents/MacOS/Microsoft Edge Beta',
'com.microsoft.edgemac.dev': '/Applications/Microsoft Edge Dev.app/Contents/MacOS/Microsoft Edge Dev',
'com.brave.browser': '/Applications/Brave Browser.app/Contents/MacOS/Brave Browser',
// etc.
};
If osascript/defaults resolution fails, try the known path from the map before returning null. Also add existence check (fs.existsSync) before returning.
Environment
- macOS (Darwin 24.6.0, x64)
- OpenClaw 2026.3.13
- Default browser: Microsoft Edge (
com.microsoft.edgemac)
- Chrome also installed (causes incorrect fallback)
Summary
On macOS,
detectDefaultChromiumExecutableMac()correctly reads the system default browser bundle ID from LaunchServices (e.g.com.microsoft.edgemac), but the subsequent osascript-based path resolution silently fails, causing a fallback to the hardcoded candidate list which starts with Chrome.Repro
browser.executablePathoverrideopenclaw browser statusExpected:
detectedBrowser: edge,detectedPath: /Applications/Microsoft Edge.app/Contents/MacOS/Microsoft EdgeActual:
detectedBrowser: chrome,detectedPath: /Applications/Google Chrome.app/Contents/MacOS/Google ChromeRoot Cause
In
detectDefaultChromiumExecutableMac():The osascript call uses
com.microsoft.edgemac(the LaunchServices bundle ID), but this may not match the bundle ID registered in Edge'sInfo.plist(com.microsoft.Edge), causing the lookup to fail. When either call returns null, the function returns null and the code falls through to the hardcoded fallback list (Chrome first).Suggested Fix
Add a fallback path resolution map for known bundle IDs before giving up:
If osascript/defaults resolution fails, try the known path from the map before returning null. Also add existence check (
fs.existsSync) before returning.Environment
com.microsoft.edgemac)