I always hate compiling and building. It's an error-prone path filled with riddles and unknowns.

mosh is a great tool replacing ssh in many cases, sadly it does not provide an arm64 binary download or installer for M1/M2/M3 MacBooks. Moreover I dont like XCode and protected /usr/bin shit so I prefer isolated envs like miniconda3.

Anyway, for such a detour, following the official mobile-shell build wiki, type these commands:

conda install autoconf automake libprotobuf pkg-config tmux
# use libncursesw 6.5 since  6.4 is buggy, rpath and dyld not load LC_RPATH shit
conda install conda-forge::ncurses
git clone --depth=1 https://github.com/mobile-shell/mosh.git`
cd mosh

./autogen.sh
./configure --prefix $CONDA_PREFIX
make check
make
make install

And it's done. All thanks to authors for open source project and butter-smooth build scripts.