The Journey to Ruby 1.9

Thanks to some late-night hacking at Boston.rb and plenty
of awesome contributors, our gems are now Ruby 1.9 compatible. If you’re
wondering what’s different in the newest version of Ruby, check out this great
list from Eigenclass.org.
Here’s some tips and tricks for those who want to upgrade their own Ruby install
and have their gems to be compatible.

It’s dead easy to run Ruby 1.8.* and 1.9 together on the same machine. Check
out how to install it on OS X
here,
or on Ubuntu
here.
If you’ve got a great blog post on how to install it on your favorite OS, drop a
comment. The most important thing to remember is when you configure your
install, add

--program-suffix=1.9

as a flag so all of the binaries end in 1.9. Also, don’t forget to grab the
latest RubyGems version. Once you’ve
got it downloaded and unpacked, install with:

sudo ruby1.9 setup.rb --format-executable

Make sure to tack on --format-executable whenever you do a gem1.9 install.
This will setup executables with the 1.9 suffix, so for instance you can have
cucumber and cucumber1.9 living harmoniously together.

The basic solution to this is adding # encoding: utf-8 to the top of your
file. Ruby just won’t parse the file without it. Of course, if your file has a
different encoding you’ll need use that instead.

We test all of our gems on 1.8.7 and 1.9.1 on our Integrity CI
server as well, if you’re curious. As of today we’re
not yet running full time on 1.9, but we hope to be there soon. The main reason
we’re not is because some gems/plugins aren’t compatible, and some hosts don’t
support it. We’ll post more articles in the future once we’re running our Rails
projects on Ruby 1.9.