To install any ruby gem which has a command-line interface on Ubuntu 8.10, you have to add a path to your PATH environment variable. In your .bashrc file, add the following line:

export PATH=$PATH:/var/lib/gems/1.8/bin

Also worth noting is the fact that the default ruby interpreter on 8.10 is back to the 1.8 branch: it’s 1.8.7 (1.9 was the default on 8.04 iirc). 1.9  also be installed right besides 1.8.

$ ruby --version
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
$ ruby1.9 --version
ruby 1.9.0 (2008-06-20 revision 17482) [i486-linux]

Neither comes installed by default, however. You must install them explicitly.

sudo aptitude install ruby irb rubygems

While I’m at it, why not mention that rubygems 1.2.0 is installed by default. It doesn’t want to update to 1.3.0 with the usual “gem update –system” command. Since it’s not my main machine I didn’t investigate further, but the suggestion is to use apt-get or aptitude. The repos don’t seem to be up to date with 1.3.0, but rather with a version named something like 1.3.0really1.2.0.

6 Responses to “Installing gems with command-line interfaces on Ubuntu 8.10”

  1. John says:

    To update rubygems for some versions you need to ‘sudo gem install rubygems-update’ … this will fix the issue.

  2. You won’t have much luck with the rubygems-update gem on Ubuntu because of the way they split RubyGems into two separate packages, rubygems and libgems-ruby.

    Brightbox maintain an Ubuntu PPA of updated Ruby packages including RubyGems. You can find instructions on setting up the repo at https://launchpad.net/~ubuntu-ruby-backports/+archive

    As a bonus, you can find an Ubuntu-ready Passenger package in the repo too!

  3. Radarek says:

    I install only ruby by apt-get. Rubygems I install from source and all other packages I install it by rubygems. I think it’s the best practice.

    “1.9 was the default on 8.04 iirc”. No it wasn’t. 1.9 currently isn’t stable to include it as default package on any platform.

  4. @Radarek I strongly disagree about it being a best practice. Rolling software from source negates using a binary distribution. Slackware is beckoning. :-)

    If your distribution has a package manager you should use it. Heaven knows what stuff you install from source will conflict with your distribution’s updates. Also, you get security updates and bugfixes for free.

    The Brightbox repo has RubyGems packages that are updated really frequently.

  5. @Radarek You’re right, idrc (I didn’t remember correctly ;) I vaguely remembered linking the gem1.8 executable to gem after building it and got that confused with linking the actual Ruby interpreter.

    @Lindsay Thanks for the link. As for building rubygems I’d have to agree with Radarek, however. Either for building a server or setting up one’s main machine. If you “build” Rubygems (it’s just Ruby, so it’s basically an install), afterwards it can update itself with the command mentioned in the article. Which lets you be as current as possible as soon as something’s available. The Ubuntu team and other distros do an awesome job, but they also have a lot on their plate, so updates are often trailing a few weeks/months behind, depending on the visibility of the project.

    For most other things I usually go with what the distro provides though. But I still think there’s something to be said about building most of what’s public-facing on one’s server. It lets you react instantly if a vulnerability gets out (and gets fixed).

    As for your point about the distro clobbering something you built, I somewhat agree. If you install rubygems and a few gems from the repo after building it, there will probably precedence problems. On the other hand Ruby is not installed by default for the moment, so we know nothing in the base system depends on it. At least for the time being…

  6. Brian Takita says:

    Gah, the rubygems package has seriously lagged in the past and puts the gems in a weird place (/var/somewhere).

    I’ve had much better luck just installing from the tarball.

Sorry, the comment form is closed at this time.