Mosh: The mobile shell

Mosh

Mosh is a remote login system that supports disconnected operations without having to log back in. I’ve tried to install it before, but gave up as all it did was throw error messages about not supporting UTF-8 back at me. Having taken the time to look into it, and ending up starting the mosh-server and mosh-client manually (instead of via the mosh wrapper script), I finally figured out what I needed to do to make it work.

I have a somewhat unusual preference for setting up my locales. I basically prefer to have just about everything as it is in the en_GB locale, but being Norwegian I need to be able to use the three characters æ, ø and å (Æ, Ø and Å in uppercase) as well. To achieve this I have my locale related environment set up like this:

LANG=en_GB.utf8

This is the default for all the locale classes. But to have access to the Norwegian characters, I need to override LC_CTYPE:

LC_CTYPE=nb_NO.UTF-8

For reasons unknown, this caused the mosh startup wrapper to become confused, throwing the above errors. So after a bit of digging, a bit more trial and error and quite a bit of swearing, I found out that the way to start mosh from my MacBook was as follows:

mosh --server="LANG=en_GB.utf8 LC_CTYPE=nb_NO.UTF-8 mosh-server" <HOST>

Works like a charm! I do most of my work with Terminal in full-screen mode, and there is something very satisfying about closing my MacBook mid sentence in a remote Mutt/Vim session, carrying it home, re-opening it and be able to just continue writing! Extremely cool!

To not have to type the monster command every time, I added the following to my .bash_profile (all on one line):

alias mosh='mosh --server="LANG=en_GB.utf8 LC_CTYPE=nb_NO.UTF-8 mosh-server"'

https://mosh.mit.edu/