After adding an Open Pull Request command to Sublime Merge using the git-pr NPM package, Sublime Merge could only find git-pr when opened via the smerge binary, not Finder.

how Sublime finds its $PATH

Sublime Merge inherits its $PATH when opened from command line. When opened via Finder, Sublime finds the default shell from $SHELL and creates a login shell to find the $PATH.

We can simulate what Sublime Merge will find with the following command:

env -i "$SHELL" -l -c "env"  | grep '^PATH'

Calling env -i will call our $SHELL with an empty environment. $SHELL -l will open a login shell and -c "env" will run the command, env, so we can see the environment generated by our login shell. We use grep to show just the $PATH environment variable.

login vs interactive shell

Since the shell that Sublime creates is a login shell, and not an interactive session, .zshrc won’t be loaded. This means only $PATH modifications in .zprofile or .zshenv will be found. .zshrc will be ignored.

In my case, the .volta directory that held git-pr was incorrectly added to the $PATH in ~/.zshrc, so Sublime Merge wasn’t seeing git-pr in the $PATH.

For more information on how configuration files are read by zsh, see this Stack Overflow post.

updating the $PATH for Sublime

I added Volta to my $PATH in ~/.zprofile (~/.zshenv also works) and Sublime Merge was able to find git-pr.

export VOLTA_HOME="$HOME/.volta"
export PATH="$VOLTA_HOME/bin:$PATH"