Ruby 1.9.1 & Friends: 11 Months On
December 5th, 2009 by RadarI admit that the title would be cooler if this were “1 year on” but I couldn’t wait. Sorry.
Back in January I wrote a post about installing Ruby 1.9.1 on my Mac OS X box and the issues associated with it. The “end goal” was to get rboard running on it under passenger. This was painful back in January! It’s so much easier now!
Unfortunately, there’s still this bug which effects you if you’re on Passenger and 1.9.1. There’s a patch for one of the answers there and that’ll get your application working, but I’m of the belief that you should not ever have to patch a gem and especially the Ruby source.
I want to know: Have you tried running your app on 1.9? Have you encountered any showstoppers?
Quite a lot has changed since January and I’ve decided instead of updating that post, I’m going to go through the entire process again. This is because I would like to show how far Ruby has come during the time since I have written and updated that post and that running your application on Ruby 1.9.1 isn’t as much hassle as people make it out to be.
This time I will be installing it all on an Ubuntu box, since that’s more than likely the location where you’re going to be deploying your app’s code to. I’ll be using Ruby 1.9.1p243 and Rails 2.3.5.
For those of you who don’t like long blog posts here’s the script if you want to install everything without reading through the cruft. Running this script or bash -c “`wget -O – frozenplague.net/boris`” on your server will install the bare-basics:
- git (latest version)
- apache 2
- mysql 5
- ruby 1.9.1
- rails (latest gem version)
- passenger (latest gem version)
Then you’ll be able to setup your Rails app. I can’t do that for you, sorry. My scripting-fu is not that good.
Thanks to Ben Hoskings for the inspiration for this script.
The Long Road
To install Ruby 1.9.1 from source on a base Ubuntu system there’s a couple of pre-requisites. Let’s cover why they’re required.
build-essential
Includes stuff that is, well, essential to building things, like Ruby and the other dependencies.
libssl-dev
Needed for when we go to install Passenger. If not installed you’ll get no such file to load -- openssl because Ruby didn’t install openssl because this dependency was not installed. Fun times were had.
libreadline-dev
Needed for launching script/console. It’ll complain no such file to load -- readline when trying to launch it.
zlib
When you go to sudo gem install rails you’ll get no such file to load -- zlib. This error message is not helpful but it means you need zlib1g installed: sudo apt-get install zlib1g-dev
Now you’ll be able to download and install ruby:
mkdir ruby cd ruby wget --progress=bar ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p243.tar.gz -O - | tar -zxf - --strip-components 1 ./configure make echo "Need your password to install Ruby:" sudo make install
And then finally your gems:
cd ~ sudo rm -rf ruby sudo gem install mysql passenger rails sudo passenger-install-apache2-module
I needed to patch Ruby + Passenger with this patch, as when I went to log in to rboard it gave me the error at the top of that page.
Other than that, all of this works perfectly fine on my bare-bones Ubuntu box. I was even able to get rboard running on this setup!
So again: Have you tried running your app on 1.9? Have you encountered any showstoppers? Really keen to hear your stories!

December 6th, 2009 at 9:28 pm
… or you could just install the ruby1.9.1 package?
December 7th, 2009 at 9:22 am
[...] have made a followup postto this which contains more up-to-date information. This post is left here as an example of the [...]
December 8th, 2009 at 5:18 pm
James,
The ruby1.9.1 package does not exist and also installs Ruby as “ruby1.9″. Installing from source does not do this. Further more, it does not install irb or ri. Whilst I am sure there are packages for these, they are probably installed with the extensions also.
December 8th, 2009 at 5:42 pm
[...] Ruby 1.9.1 & Friends: 11 Months On, the new version has become easier to live with. Perhaps now is a good time to switch? [...]
December 8th, 2009 at 10:28 pm
Thank you for revisiting this. Embarking on the same adventure as you, I choose the rvm route. Getting and compiling a specific version of ruby is as easy as typing “rvm install RUBY_VERSION”. Interpolate as needed.
The tempfile patch you’re pointing to, does seem to resolve the nasty error on POST requests. In my setup, however, it comes at a cost. After applying the fix, I’m limited to a few restarts (using tmp/restart.txt), after which requests are no longer served. They just hang indefinitely. Needless to say, I’m currently searching for a more robust solution
December 12th, 2009 at 7:26 am
“When you go to sudo gem install rails you’ll get no such file to load — zlib. This error message is not helpful but it means you need zlib installed. I installed this from source because I couldn’t find an apt package for it:”
apt-get install zlib1g-dev
December 13th, 2009 at 11:04 am
Thanks Paul I’ve amended the script and the post!
January 6th, 2010 at 6:34 pm
Ryan, I was considering upgrading to Ruby 1.9.1 but then I saw a Google Tech Talk video on Ruby Enterprise Edition but the Phusion guys, and was like totally blown away. At this point I’m conflicted on which version of ruby to use and wanted to know your point of view and why you went with 1.9.1 and not 1.8.7 Enterprise Edition?
April 20th, 2010 at 4:06 pm
Thanks Paul, this script is fantastic! Saved me hours.
April 20th, 2010 at 4:07 pm
Er, sorry, I meant to thank Radar. :) (but Paul you’re pretty great too.)