TIL

zshenv

24.10.2023

zshenv is similar to zshrc, but it is loaded for all kinds of shells. zshrc on the other hand is only sourced for interactive shells. I discovered this while trying to use mosh-server on a mac. mosh-server is installed with brew so the binary is in /opt/homebrew/bin/ and since I had only setup the path for homebrew in zshrc it was not accessible through non-interactive ssh connections that the mosh clients use to start the mosh-server. Now my zshenv looks like this:

PATH=/opt/homebrew/bin/:$PATH