MCPcopy Index your code
hub / github.com/codeaashu/claude-code / detectHomebrew

Function detectHomebrew

src/utils/nativeInstaller/packageManagers.ts:103–122  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

101 * - npm-global (via Homebrew's npm): /opt/homebrew/lib/node_modules/@anthropic-ai/...
102 */
103export function detectHomebrew(): boolean {
104 const platform = getPlatform()
105
106 // Homebrew is only for macOS and Linux
107 if (platform !== 'macos' && platform !== 'linux' && platform !== 'wsl') {
108 return false
109 }
110
111 // Get the path of the currently running executable
112 const execPath = process.execPath || process.argv[0] || ''
113
114 // Check if the executable is within a Homebrew Caskroom directory
115 // This is specific to Homebrew cask installations
116 if (execPath.includes('/Caskroom/')) {
117 logForDebugging(`Detected Homebrew cask installation: ${execPath}`)
118 return true
119 }
120
121 return false
122}
123
124/**
125 * Detects if the currently running Claude instance was installed via winget

Callers 3

packageManagers.tsFile · 0.85

Calls 2

getPlatformFunction · 0.85
logForDebuggingFunction · 0.85

Tested by

no test coverage detected