Homebrew + Fish + Nova errors

I am new to Nova.
I wish to use the local terminal.
fish is my default
My ~/.config/fish/config.fish includes the following line, as requested by Homebrew:

eval (/opt/homebrew/bin/brew shellenv)

This works in Terminal.app.

In Nova, I see an error.
I narrowed this down to https://github.com/Homebrew/brew/blob/master/Library/Homebrew/cmd/shellenv.sh#L21.

In particular, the Homebrew scripts run /bin/bash and then check $PPID.
This is equivalent, I believe, to checking the CMD of $fish_pid.

On Nova, I see this is -l:

adam@Adam-MBA-M2 ~> ps | grep $fish_pid
22004 ttys006    0:00.05 -l

on Terminal.app I see that this is -fish, as expected by the Homebrew scripts.

adam@Adam-MBA-M2 ~> ps | grep $fish_pid
21609 ttys005    0:00.05 -fish

Help in understanding this / getting the Homebrew scripts to work in Nova would be much appreciated.

I don’t have any insight into why this problem is happening in the first place, but I did find a workaround. You can actually pass the shell name explicitly to get the fish-compatible configuration even when the shell detection fails. If you use brew shellenv fish instead of just brew shellenv it seems to work correctly.

1 Like

I’m also confused about what could be causing the shell name to be set to “-l”, but the way I dealt with it was by adding this snippet to my .config/fish/config.fish file:

if status is-interactive
  if test "$__CFBundleIdentifier" = com.panic.Nova; and test (ps -p $fish_pid -o command=) = "-l"
    exec login -qpf $USER $SHELL
  end
end

Alternatively: using the command exec login -lqpf $USER $SHELL will preserve the shell’s current directory but also removes the leading “-” from the process name

Opening a new terminal tab in Nova and checking for the process name now gives the correct results, fixing other init scripts (e.g., pyenv) that check for the shell name and don’t allow an override the way the brew shellenv command does:

❯ ps | grep $fish_pid
41766 ttys002    0:00.03 -fish