Skip to content

init.zsh silently skips the proxy when ghost-complete isn't on PATH yet (Homebrew shellenv later in .zshrc); doctor reports healthy #242

Open

Description

@andreynaldoni

Description

After brew install StanMarek/tap/ghost-complete + ghost-complete install, new Ghostty tabs started without the proxy. Autocomplete only worked after running source ~/.zshrc by hand. ghost-complete doctor reported everything as OK.

Cause: the ghost-complete initialize block sits at the top of .zshrc, and shell/init.zsh only execs the proxy when command -v ghost-complete succeeds (lines 88 and 126). On Apple Silicon, /opt/homebrew/bin is usually added by eval "$(/opt/homebrew/bin/brew shellenv)", which often lives later in .zshrc (my case) instead of .zprofile. When the init block runs, the binary is not on PATH, command -v fails, and init does nothing without printing anything. A manual source ~/.zshrc runs with the full PATH, so the proxy starts then. That makes the problem look intermittent and hard to diagnose.

Confirmed with a clean login shell:

$ env -i HOME=$HOME /bin/zsh -lc 'command -v ghost-complete || echo NOT_FOUND'
NOT_FOUND

In an affected tab, echo $GHOST_COMPLETE_ACTIVE was empty and the shell's parent was /usr/bin/login, not ghost-complete.

Workaround: put eval "$(/opt/homebrew/bin/brew shellenv)" at the top of ~/.zprofile.

Suggestions:

  • Have ghost-complete install write the absolute path of the binary into the init block (or into init.zsh), so startup doesn't depend on PATH order.
  • Or print a one-line warning when the terminal is supported but ghost-complete is not on PATH.
  • Have doctor check this case. It ran from an already-fixed shell, so it reported "shell integration looks healthy". It could run something like env -i HOME=$HOME $SHELL -lic 'command -v ghost-complete', or compare the parent process.

This seems related to the startup work in #186, but I didn't see the PATH case mentioned there.

Steps to reproduce

  1. On Apple Silicon, install via Homebrew and run ghost-complete install.
  2. Keep eval "$(/opt/homebrew/bin/brew shellenv)" in .zshrc below the ghost-complete initialize block, with nothing in .zprofile adding /opt/homebrew/bin.
  3. Quit Ghostty and open a new window.
  4. Observe that there is no popup and echo $GHOST_COMPLETE_ACTIVE is empty. After source ~/.zshrc, the popup works.

Expected behavior

The proxy should start in every new tab, or ghost-complete should warn that it couldn't find its binary. doctor should flag the problem.

Ghost Complete version

ghost-complete 0.19.1 (738f3db 2026-10-03T08:25:53Z)

Terminal

Ghostty (1.4.0)

Shell

zsh 5.9 (arm64-apple-darwin25.0), oh-my-zsh + powerlevel10k

macOS version

macOS 26.7.2

Logs

Nothing logged: init.zsh returns before the binary is ever invoked.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions