Upgrading to Ruby 1.8.5

Thursday, December 21

Today I realized that I was running Ruby 1.8.4. Actually, I knew I was running 1.8.4, but I’d been ignoring the fact because I’m too lazy to update and I lacked a compelling reason. Well, tonight I decided to bite the bullet and upgrade. It was a painless affair. Unlike Obie’s experience.

Here’s a little script I wrote to automate the process before I started. I generally like to script things ahead of time because doing so is less error prone. You get to think about what you’re doing before you do it. Anyways, YMMV.

#!/bin/sh

PREFIX="/usr/local" 
READLINE_VERSION="5.2" 
RUBY_VERSION="1.8.5-p2" 

curl -O ftp://ftp.gnu.org/gnu/readline/readline-${READLINE_VERSION}.tar.gz
tar xzvf readline-${READLINE_VERSION}.tar.gz
pushd readline-${READLINE_VERSION}
./configure --prefix=${PREFIX}
make
make install
popd

curl -O ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-${RUBY_VERSION}.tar.gz
tar zxvf ruby-${RUBY_VERSION}.tar.gz
pushd ruby-${RUBY_VERSION}
./configure --prefix=${PREFIX} --enable-pthread --with-readline-dir=${PREFIX}
make
make install
popd

Save this to a file named install_ruby.sh and run it from the CLI as follows:

$ sudo sh install_ruby.sh

That should do it.