Skip to content

Instantly share code, notes, and snippets.

@physacco
Created May 9, 2013 09:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save physacco/5546437 to your computer and use it in GitHub Desktop.
Save physacco/5546437 to your computer and use it in GitHub Desktop.
Bash scripts for installing MRI ruby 1.9.3 & 2.0.0 from source.
#!/bin/bash
set -e
PREFIX="$HOME/local/ruby/1.9.3"
RUBY_DIST_URL="ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p392.tar.gz"
RUBY_DIST_PKG=`basename $RUBY_DIST_URL`
RUBY_DIST_DIR=`basename $RUBY_DIST_PKG .tar.gz`
DOWNLOAD_DIR=$HOME/src
# install dependencies
# if [ -x /usr/bin/apt-get ]; then
# apt-get install libffi-dev
# apt-get install libyaml-dev
# ...
# fi
# download the package
mkdir -p $DOWNLOAD_DIR
cd $DOWNLOAD_DIR
[ ! -f $RUBY_DIST_PKG ] && wget $RUBY_DIST_URL
# extract the package
tar xzf $RUBY_DIST_PKG
cd $RUBY_DIST_DIR
# configure
[ ! -f Makefile ] && ./configure --enable-shared --disable-install-doc --prefix=$PREFIX
# make and install
make && make install
# hint
echo "$RUBY_DIST_DIR has been installed to $PREFIX"
echo "You can delete $DOWNLOAD_DIR/$RUBY_DIST_PKG and $DOWNLOAD_DIR/$RUBY_DIST_DIR/"
#!/bin/bash
set -e
PREFIX="$HOME/local/ruby/2.0.0"
RUBY_DIST_URL="ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p0.tar.gz"
RUBY_DIST_PKG=`basename $RUBY_DIST_URL`
RUBY_DIST_DIR=`basename $RUBY_DIST_PKG .tar.gz`
DOWNLOAD_DIR=$HOME/src
# install dependencies
# if [ -x /usr/bin/apt-get ]; then
# apt-get install libffi-dev
# apt-get install libyaml-dev
# ...
# fi
# download the package
mkdir -p $DOWNLOAD_DIR
cd $DOWNLOAD_DIR
[ ! -f $RUBY_DIST_PKG ] && wget $RUBY_DIST_URL
# extract the package
tar xzf $RUBY_DIST_PKG
cd $RUBY_DIST_DIR
# configure
[ ! -f Makefile ] && ./configure --enable-shared --disable-install-doc --prefix=$PREFIX
# make and install
make && make install
# hint
echo "$RUBY_DIST_DIR has been installed to $PREFIX"
echo "You can delete $DOWNLOAD_DIR/$RUBY_DIST_PKG and $DOWNLOAD_DIR/$RUBY_DIST_DIR/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment