fix(cli): correct Homebrew installation detection (#14727)

Co-authored-by: Gal Zahavi <38544478+galz10@users.noreply.github.com>
Co-authored-by: Jack Wotherspoon <jackwoth@google.com>
This commit is contained in:
kij
2026-01-19 16:37:32 +01:00
committed by GitHub
parent a4eb04b7d4
commit 4cfbe4c716
2 changed files with 72 additions and 17 deletions
+16 -10
View File
@@ -80,16 +80,22 @@ export function getInstallationInfo(
// Check for Homebrew
if (process.platform === 'darwin') {
try {
// The package name in homebrew is gemini-cli
childProcess.execSync('brew list -1 | grep -q "^gemini-cli$"', {
stdio: 'ignore',
});
return {
packageManager: PackageManager.HOMEBREW,
isGlobal: true,
updateMessage:
'Installed via Homebrew. Please update with "brew upgrade gemini-cli".',
};
const brewPrefix = childProcess
.execSync('brew --prefix gemini-cli', {
encoding: 'utf8',
stdio: ['ignore', 'pipe', 'ignore'],
})
.trim();
const brewRealPath = fs.realpathSync(brewPrefix);
if (realPath.startsWith(brewRealPath)) {
return {
packageManager: PackageManager.HOMEBREW,
isGlobal: true,
updateMessage:
'Installed via Homebrew. Please update with "brew upgrade gemini-cli".',
};
}
} catch (_error) {
// Brew is not installed or gemini-cli is not installed via brew.
// Continue to the next check.