Sep 28, 2010

Installing Rubygems on Ubuntu

Zed Shaw's rant today about Rubygems on Debian reminded me of an important note to all people coding in Ruby on Ubuntu: don't use rubygems from the Ubuntu repositories. My main problem is that it is not kept up-to-date, and newer gems depend on newer features that are not always present on Ubuntu.

Normally you don't really want to install stuff from source unless you have to because Ubuntu provides you with software updates so that you don't have to go out and update everything yourself, but unfortunately since they aren't as timely as we would like with this particular software it's alright to make an exception - especially since it has an update feature built-in.

So to install Rubygems from source, you can use this at the terminal (make sure to check and see if the version has changed, since I won't be able to constantly update this post):
wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz
tar -zxvf rubygems-1.3.7.tgz
cd rubygems-1.3.7
sudo ruby setup.rb
You should be able to just follow the instructions that it prints out and it will do what it needs to do. Then when you want to update the actual rubygems software:
sudo gem update --system
Simple! This way you don't need to depend on the Ubuntu package maintainers to update the software for you, and you can use all of the latest-and-greatest gems that come out each day.

3 comments:

jc00ke said...

There's always RVM, which comes with a rubygems for all the rubies out there.

Trevoke said...

Yeah - what you really want to do is use RVM. It's a little tricky, since you can use several Rubies, and several gemsets, but that is in fact precisely why it is so powerful (especially coupled with Bundler).

Rob Britton said...

Heh whenever I get back into Ruby I always feel so out of the loop. The gems are all different, the tools are different, etc. For the most part they're all for the better, but it just seems like a continual learning curve.