Skip to content

Fix: resolve gh CLI path for macOS GUI apps - #196

Merged
tylergraydev merged 1 commit into
tylergraydev:mainfrom
prefrontalsys:fix/macos-gh-path-resolution
Apr 14, 2026
Merged

tylergraydev merged 1 commit into
tylergraydev:mainfrom
prefrontalsys:fix/macos-gh-path-resolution

Conversation

@prefrontalsys

Copy link
Copy Markdown
Contributor

Summary

  • macOS GUI apps launched from Finder/Spotlight inherit a minimal PATH (/usr/bin:/bin:/usr/sbin:/sbin) that excludes Homebrew directories
  • Command::new("gh") fails with NotFound, showing "gh CLI not installed" even when gh is installed and working from the terminal
  • Adds a find_gh() helper that checks /opt/homebrew/bin/gh (Apple Silicon) and /usr/local/bin/gh (Intel) before falling back to bare gh

Test plan

  • Launch app from Finder on macOS with gh installed via Homebrew
  • Verify Cloud Sync page shows "Connect" button instead of "gh CLI not installed"
  • Verify gh auth token retrieval works after connecting

Fixes #194

🤖 Generated with Claude Code

macOS GUI apps launched from Finder/Spotlight inherit a minimal PATH
(/usr/bin:/bin:/usr/sbin:/sbin) that excludes Homebrew directories.
This causes `Command::new("gh")` to fail with NotFound, showing
"gh CLI not installed" even when gh is installed and working from
the terminal.

Add `find_gh()` helper that checks common Homebrew install locations
(/opt/homebrew/bin/gh, /usr/local/bin/gh) before falling back to
bare `gh` for PATH-based resolution.

Fixes tylergraydev#194

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@tylergraydev tylergraydev left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well-scoped fix. find_gh() correctly checks both Homebrew paths before falling back to bare gh, and on non-macOS platforms the hardcoded paths won't exist so it degrades gracefully. Both call sites updated.

LGTM, merging.

@tylergraydev
tylergraydev merged commit 15db3ff into tylergraydev:main Apr 14, 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.

Cloud Sync: gh CLI not found on macOS when launched from Finder

2 participants