Menu
1 min read

fix for Mosh Server in macos error: command not found `mosh-server`

if you’re trying to remotely access your macbook through mosh after installing the mosh cli through homebrew, we may get this error.

zsh:1: command not found: mosh-server Connection to 100.94.16.82 closed. /usr/bin/mosh: Did not find mosh server startup message. (Have you installed mosh on your server

it’s because, mosh logins using ssh at first, then spawn a mosh-server.

but at that point, path entries on the .zshrc, .zprofile files are not loaded.

for the fix, we need to add the homebrew path to the padin the a file named .zshenv. this file will be read before anything else.

for the below content to the .zshenv file and the mosh should work properly

# Add Homebrew to PATH
export PATH="/opt/homebrew/bin:$PATH"