Skip to content

Instantly share code, notes, and snippets.

@xiaom
Last active April 2, 2024 16:48
Show Gist options
  • Save xiaom/8264691 to your computer and use it in GitHub Desktop.
Save xiaom/8264691 to your computer and use it in GitHub Desktop.
install mosh locally
#!/bin/sh
# this script does absolutely ZERO error checking. however, it worked
# for me on a RHEL 6.3 machine on 2012-08-08. clearly, the version numbers
# and/or URLs should be made variables. cheers, [email protected]
mkdir mosh
cd mosh
ROOT=`pwd`
echo "==================================="
echo "about to set up everything in $ROOT"
echo "==================================="
mkdir build
mkdir install
cd build
curl -O http://protobuf.googlecode.com/files/protobuf-2.4.1.tar.gz
curl -O http://cloud.github.com/downloads/keithw/mosh/mosh-1.2.2.tar.gz
tar zxvf protobuf-2.4.1.tar.gz
tar zxvf mosh-1.2.2.tar.gz
echo "================="
echo "building protobuf"
echo "================="
cd $ROOT/build/protobuf-2.4.1
./configure --prefix=$HOME/local --disable-shared
make install
echo "============="
echo "building mosh"
echo "============="
cd $ROOT/build/mosh-1.2.2
export PROTOC=$HOME/local/bin/protoc
export protobuf_CFLAGS=-I$HOME/local/include
export protobuf_LIBS=$HOME/local/lib/libprotobuf.a
./configure --prefix=$HOME/local
make install
echo "==="
echo "if all was successful, binaries are now in $ROOT/install/mosh/bin"
echo "==="
@jzhan039
Copy link

@paulirish I was getting the same error. And I installed it by following your suggestion. However, when I run 'mosh', I had another error, 'Bareword "AI_NUMERICHOST" not allowed while "strict subs" in use at ~/mosh/bin/mosh line 489'. Any idea how to solve this problem?

@erkkel
Copy link

erkkel commented Aug 29, 2017

This following code worked for me. I applied the export CXXFLAGS="$CXXFLAGS -fPIC" as paulirish mentioned. However, I used libprotobuf.a instead of libprotobuf.so because I got weird errors whenever I tried to use libprotobuf.so. If you still can't use mosh after running the following code, try using the --server option in mosh.

mkdir mosh
cd mosh

ROOT=`pwd`

echo "==================================="
echo "about to set up everything in $ROOT"
echo "==================================="

mkdir build
mkdir install

cd build
curl -O https://codeload.github.com/google/protobuf/tar.gz/v3.4.0
curl -O https://mosh.org/mosh-1.3.2.tar.gz
tar zxvf v3.4.0
tar zxvf mosh-1.3.2.tar.gz

echo "================="
echo "building protobuf"
echo "================="


cd $ROOT/build/protobuf-3.4.0
export CXXFLAGS="$CXXFLAGS -fPIC"
./autogen.sh
./configure --prefix=$HOME/local --disable-shared
make install


echo "=============" 
echo "building mosh"
echo "============="

cd $ROOT/build/mosh-1.3.2
export PROTOC=$HOME/local/bin/protoc
export protobuf_CFLAGS=-I$HOME/local/include
export protobuf_LIBS=$HOME/local/lib/libprotobuf.a
./autogen.sh
./configure --prefix=$HOME/local
make install

echo "==="
echo "if all was successful, binaries are now in $ROOT/install/mosh/bin"
echo "==="

@edsq
Copy link

edsq commented Jun 28, 2018

@jzhan039 I'm having the same issue. Did you ever solve it?

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