Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Compiling Mosh ( under Cygwin
  1. Download Cygwin.

  2. Run setup.exe and install the following packages in addition to the default ones:

    • make
    • boost
    • libncurses-devel
    • pkg-config
    • perl
  3. Download and compile Protocol Buffers (make sure there are no spaces in the working directory when compiling Protocol Buffers, make will fail if there are):

     $ tar zxvf protobuf-2.4.1.tar.gz
     $ cd protobuf-2.4.1
     $ ./configure
     $ make
     $ make install
  4. Download and compile Mosh:

     $ tar zxvf mosh-1.1.3.tar.gz
     $ cd mosh-1.1.3
     $ ./configure CPPFLAGS="-I/usr/include/ncurses" PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
     $ make
     $ make install
  5. Install the IO::Pty Perl module:

     $ perl -MCPAN -e shell
     cpan> install IO::Pty
  6. Rock’n’roll.

You might want to add in the 'make' and 'make install' at the end of 4 for completeness.
The Cygwin compile worked great! thanks, nik.. .
ps: I've still to get the server working on an older system to really see this working for me.


eerohele commented Apr 11, 2012

@nikunjvaidya: added, thanks! Don't know how I managed to leave that out.

Glad to hear it's working, though.

tdl commented Apr 11, 2012

Cygwin compile working great here as well, thanks for this.

I combined this with puttycyg to get a Windows mosh client.

My build failed:

checking for a BSD-compatible install... /bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking for ranlib... ranlib
checking for protoc... /usr/local/bin/protoc
checking for library containing utempter_remove_added_record... no
configure: WARNING: Unable to find libutempter; utmp entries will not be made.
checking for library containing compress... -lz
checking for boostlib >= 1.20.0... yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking curses.h usability... no
checking curses.h presence... no
checking for curses.h... no
configure: error: Missing required header file.

@mqhiller do:

ls /usr/include/ncurses/curses.h

If you have that file, you aren't setting CPPFLAGS in your configure command.

If you don't have it, you need to install libncurses-devel in Cygwin setup.exe.

If you follow all of the original directions precisely you will get a working mosh install.


eerohele commented Apr 12, 2012

@mqhiller: Well, this probably falls more into general Mosh troubleshooting than Cygwin-specific stuff, but make sure your server also has Mosh installed and UDP ports 60000-61000 open.

See for more info.

@mqhiller is mosh-server installed in your path on If it's installed but not in your path, use the client flag --server=/path/to/mosh-server to specify the path to it. If it's not installed, install it.


ghost commented Jun 10, 2012

This doesn't work for me, it just says, "hangup"

shdobxr commented Jun 20, 2012

See notes here:

The problem is that we weren't using mosh correctly. See below. You must log onto the remote host using SSH. Then start mosh-server. This in turn gen's a key and a port. See below. That was the fix for me. Also make sure that you have setup your iptables and/or firewall(s) to allow this traffic through.

Now I run on the server:


MOSH CONNECT 60001 qbE+SNhaEJpfzFpHcXBwkw

and on the client:

MOSH_KEY=qbE+SNhaEJpfzFpHcXBwkw mosh-client 60001

You might also mention that protobuf make will fail if the working directory has spaces in the path.

I'm having an issue where the client immediately hangsup when I try to connect. Any ideas what might be causing this?

What I see is following message.

shdobxr commented Jul 19, 2012


eerohele commented Jul 23, 2012

@danep2: Will do, thanks!

ksmyth commented Jul 26, 2013

This mosh configure worked for me:
PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" ./configure CPPFLAGS="-I/usr/include/ncurses"

Current pkg-config (version 0.23b-10) installs to /usr/lib/pkgconfig/.

I also needed to install the zlib-devel and openssl-devel packages.

Thanks for the instructions.

Gareth@GARETH-PC ~/protobuf-2.5.0
$ make
make  all-recursive
make[1]: Entering directory `/home/Gareth/protobuf-2.5.0'
Making all in .
make[2]: Entering directory `/home/Gareth/protobuf-2.5.0'
make[2]: Leaving directory `/home/Gareth/protobuf-2.5.0'
Making all in src
make[2]: Entering directory `/home/Gareth/protobuf-2.5.0/src'
.deps/atomicops_internals_x86_gcc.Plo:1: *** multiple target patterns.  Stop.
make[2]: Leaving directory `/home/Gareth/protobuf-2.5.0/src'
Makefile:568: recipe for target `all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/Gareth/protobuf-2.5.0'
Makefile:477: recipe for target `all' failed
make: *** [all] Error 2

Hmm.. I guess I'll try the older version of this package then..

EDIT: Using the version of this package that was specified above..

Gareth@GARETH-PC ~/protobuf-2.4.1
$ make
make  all-recursive
make[1]: Entering directory `/home/Gareth/protobuf-2.4.1'
Making all in .
make[2]: Entering directory `/home/Gareth/protobuf-2.4.1'
make[2]: Leaving directory `/home/Gareth/protobuf-2.4.1'
Making all in src
make[2]: Entering directory `/home/Gareth/protobuf-2.4.1/src'
.deps/code_generator.Plo:1: *** multiple target patterns.  Stop.
make[2]: Leaving directory `/home/Gareth/protobuf-2.4.1/src'
Makefile:530: recipe for target `all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/Gareth/protobuf-2.4.1'
Makefile:435: recipe for target `all' failed
make: *** [all] Error 2

Using Cygwin x86_64, btw.

dburr commented Sep 9, 2013

I also needed to install libz-devel and openssl-devel to get mosh to compile, however everything is working quite nicely now. :) Running cygwin x86_64 version 1.7.25(0.270/5/3).


eerohele commented Oct 13, 2014

Note to future visitors: you don't need to compile Mosh on Cygwin yourself any more; just install the package with Cygwin's setup.exe.

Above instructions is outdated, and the mosh in Cygwin official packages is broken. Instructions to build are here: mobile-shell/mosh#850 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment