0

I'm struggling with getting brew-installed mosh-server to work on my new M2 Mac Mini. The issue is that macOS seems to block the incoming UDP connection from the client:

mosh: Nothing received from server on UDP port 60000"

Turning off the firewall works, but I don't want to disable my firewall completely.

For other programs, like iperf, when I start them on the server, I get a little notification pop up asking whether I want to approve. I don't get such a notification with mosh-server. How to fix this?

1 Answer 1

2

One needs to specifically allow incoming connections for the mosh binary. This is a bit tedious, but people have written scripts for this purpose that do the job reliably for brew-installed.

Note that you need to run this script after every brew mosh update :

fix_mosh_server() {
  local fw='/usr/libexec/ApplicationFirewall/socketfilterfw'
  local mosh_sym="$(which mosh-server)"
  local mosh_abs="$(readlink -f $mosh_sym)"

  sudo "$fw" --setglobalstate off
  sudo "$fw" --add "$mosh_sym"
  sudo "$fw" --unblockapp "$mosh_sym"
  sudo "$fw" --add "$mosh_abs"
  sudo "$fw" --unblockapp "$mosh_abs"
  sudo "$fw" --setglobalstate on
}
fix_mosh_server

The original script is from this comment: https://github.com/mobile-shell/mosh/issues/898#issuecomment-368566044

Beware that it enables your firewall (in case it is disabled).

1
  • I knew this answer would come in handy. Just reencountered this issue and the solution still works. Run this script through and mosh connects thereafter. Commented Sep 21 at 6:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .