I’m trying to connect to an M2 Mac mini with mosh
.
However, when connecting with mosh <hostname>
, I get an error zsh:1: command not found: mosh-server
:
$ mosh <username>@<hostname>
(<username>@<hostname>) Password:
zsh:1: command not found: mosh-server
Connection to m2-mini.local closed.
/opt/homebrew/bin/mosh: Did not find mosh server startup message. (Have you installed mosh on your server?)
I definitely have installed mosh on that server. When I ssh in, and run which mosh-server
I get /opt/homebrew/bin/mosh-server
:
<username>@<local_hostname> ~ % ssh <username>@<remote_hostname>
...
<username>@<remote_hostname> ~ % which mosh-server
/opt/homebrew/bin/mosh-server
A workaround is to run:
mosh [email protected] --server /opt/homebrew/bin/mosh-server
but this shouldn’t be necessary?
Interestingly, when I run a remote command with ssh -t
, I get “mosh-server not found”:
<username>@<local_hostname> ~ % ssh [email protected] -t which mosh-server
(<username>@<remote_hostname) Password:
mosh-server not found
Connection to <remote_hostname> closed.
What’s going on here?
Update:
This might have to do something with the type of shell that’s loaded. I get for example:
$ ssh <username>@<remote_hostname> -t 'echo $PATH'
/usr/bin:/bin:/usr/sbin:/sbin