Skip to content

fix: binary detection: prioritize native installer over stale Homebrew/npm paths#33

Open
BennettSchwartz wants to merge 1 commit intolcoutodemos:mainfrom
BennettSchwartz:fix/claude-binary-detection
Open

fix: binary detection: prioritize native installer over stale Homebrew/npm paths#33
BennettSchwartz wants to merge 1 commit intolcoutodemos:mainfrom
BennettSchwartz:fix/claude-binary-detection

Conversation

@BennettSchwartz
Copy link
Copy Markdown

@BennettSchwartz BennettSchwartz commented Mar 20, 2026

Summary

  • The native installer (~/.local/bin/claude) is the officially recommended install method, but _findClaudeBinary() checked /opt/homebrew/bin and /usr/local/bin first. A stale old version (e.g. v1.0.34 via Homebrew) at those paths would shadow the current install, causing unknown option '--include-partial-messages' errors at runtime.
  • Extracted the duplicated binary-detection logic from run-manager.ts, pty-run-manager.ts, and process-manager.ts into a shared find-binary.ts module.
  • Reordered detection priority: native path -> shell-resolved (whence/which) -> hardcoded fallbacks -> bare claude.
  • Replaced execSync('test -x ...') with fs.accessSync(X_OK) to avoid unnecessary shell invocation.

Test plan

  • Verify app launches and connects to Claude CLI on a machine with ~/.local/bin/claude (native install)
  • Verify fallback works when native path is absent (e.g. npm-global or Homebrew install)
  • Verify no regression when only claude is on PATH (bare command fallback)

…/npm paths

The native installer (~/.local/bin/claude) is now the officially
recommended install method, but the detection logic checked
/opt/homebrew/bin and /usr/local/bin first. This caused failures
when a stale old version (e.g. v1.0.34) existed at those paths,
shadowing the current install and producing 'unknown option
--include-partial-messages' errors.

Changes:
- Extract shared findClaudeBinary() into find-binary.ts to
  eliminate triple-duplicated logic across run-manager, pty-run-manager,
  and process-manager
- Reorder detection: native path → shell-resolved (whence/which) →
  hardcoded fallbacks → bare 'claude'
- Replace execSync('test -x ...') with fs.accessSync(X_OK) to
  avoid shell invocation
@BennettSchwartz BennettSchwartz changed the title Fix binary detection: prioritize native installer over stale Homebrew/npm paths fix: binary detection: prioritize native installer over stale Homebrew/npm paths Mar 20, 2026
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.

1 participant