Ghostree version: 0.3.18
opencode version: 1.2.16
Shell: zsh
OS: macOS
Description
Clicking the "+" icon in the sidebar to add a new session fails immediately with:
bash: line 0: exec: opencode: not found
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Ghostty failed to launch the requested command:
/usr/bin/login -flp mmorek /bin/bash --noprofile --norc -c exec -l opencode
Runtime: 47 ms
Press any key to close the window.
opencode is installed and works correctly when launched from any other terminal (Ghostty, iTerm2, Terminal.app, etc.).
Root cause
Ghostty's macOS login shell mechanism uses /bin/bash as a throwaway intermediary to exec into the target command. Critically, it passes --noprofile and --norc, which means bash starts with only the bare system PATH (typically /usr/bin:/bin:/usr/sbin:/sbin). Any PATH additions made in ~/.zshrc, ~/.zprofile, ~/.bash_profile, etc. are never sourced.
opencode's default install locations — ~/.opencode/bin, $HOME/bin, $HOME/.local/bin, or npm/bun global bin dirs — are none of them on the bare system PATH. So while opencode resolves fine in an interactive shell, it is invisible to the stripped environment Ghostree uses to launch the sidebar session.
This is not a user configuration problem. The same Ghostty-level mechanism works correctly for regular terminal windows because those launch the user's actual shell (zsh), which sources the appropriate profile files and has the full PATH. The sidebar bypasses this entirely by passing opencode as a bare command name into a profileless bash.
Steps to reproduce
- Install
opencode via the install script or npm (default install path: ~/.opencode/bin or similar user-local directory)
- Verify
opencode works: open any terminal and run opencode — it launches correctly
- Open Ghostree, click the "+" button in the sidebar
- Observe the error above
Expected behavior
A new opencode session launches in the context of the current worktree.
Actual behavior
The session window opens and immediately closes with opencode: not found.
Suggested fix
Ghostree should resolve the opencode binary path at launch time using the user's full login shell environment, then pass the absolute path to Ghostty's command config rather than the bare name opencode.
Alternatively, Ghostree could check common install locations (~/.opencode/bin, ~/.local/bin, $HOME/bin, npm/bun global prefix) at startup and warn if opencode cannot be found in any of them, rather than silently failing at session launch time.
Workaround
Symlink or copy opencode to a system PATH location:
sudo ln -s $(which opencode) /usr/local/bin/opencode
Ghostree version: 0.3.18
opencode version: 1.2.16
Shell: zsh
OS: macOS
Description
Clicking the "+" icon in the sidebar to add a new session fails immediately with:
opencodeis installed and works correctly when launched from any other terminal (Ghostty, iTerm2, Terminal.app, etc.).Root cause
Ghostty's macOS login shell mechanism uses
/bin/bashas a throwaway intermediary toexecinto the target command. Critically, it passes--noprofileand--norc, which means bash starts with only the bare systemPATH(typically/usr/bin:/bin:/usr/sbin:/sbin). Any PATH additions made in~/.zshrc,~/.zprofile,~/.bash_profile, etc. are never sourced.opencode's default install locations —~/.opencode/bin,$HOME/bin,$HOME/.local/bin, or npm/bun global bin dirs — are none of them on the bare system PATH. So whileopencoderesolves fine in an interactive shell, it is invisible to the stripped environment Ghostree uses to launch the sidebar session.This is not a user configuration problem. The same Ghostty-level mechanism works correctly for regular terminal windows because those launch the user's actual shell (zsh), which sources the appropriate profile files and has the full PATH. The sidebar bypasses this entirely by passing
opencodeas a bare command name into a profileless bash.Steps to reproduce
opencodevia the install script or npm (default install path:~/.opencode/binor similar user-local directory)opencodeworks: open any terminal and runopencode— it launches correctlyExpected behavior
A new
opencodesession launches in the context of the current worktree.Actual behavior
The session window opens and immediately closes with
opencode: not found.Suggested fix
Ghostree should resolve the
opencodebinary path at launch time using the user's full login shell environment, then pass the absolute path to Ghostty'scommandconfig rather than the bare nameopencode.Alternatively, Ghostree could check common install locations (~/.opencode/bin, ~/.local/bin, $HOME/bin, npm/bun global prefix) at startup and warn if opencode cannot be found in any of them, rather than silently failing at session launch time.
Workaround
Symlink or copy
opencodeto a system PATH location: