Install RubyGems on Ubuntu/Debian

Posted Over 13 years ago. Visible to the public.

First of all: You could just use RVM Show archive.org snapshot which would make the pain go away. If for some reason you can't, proceed.


Do not use rubygems from the apt repository.

  1. Get the latest RubyGems Show archive.org snapshot TGZ
  2. Change to the download directory and extract it:\
    tar xvfz rubygems-1.3.7.tgz
  3. If you previously had RubyGems installed via apt: \
    sudo apt-get remove rubygems
  4. Install RubyGems:\
    cd rubygems-1.3.7 && sudo ruby setup.rb
  5. Link gem to gem1.8:\
    sudo ln -s /usr/bin/gem1.8 /usr/bin/gem

If gem list does not show all gems you previously had, you can create a symlink to your old gem directory:\
cd /usr/local/lib/ruby && sudo mv gems gems-rubygems && sudo ln -s /var/lib/gems gems

If you need to have the rubygems package installed on Ubuntu

Due to a dependency from another package, you might have APT force the rubygems package (or uninstalling it like above would remove more packages than you want).\
Here is how to override the RubyGems version supplied by APT.

A solution for this problem is to create own deb packages for rubygems from the tar.gz.\
You can do this by using checkinstall:

  1. Download and extract RubyGems (like above)
  2. Instead of running setup.rb directly, use checkinstall: \
    cd rubygems-1.3.7 && checkinstall ruby setup.rb (do checkinstall with sudo if you want to install the created deb directly)
  3. Follow instructions on screen.
  4. You now have a .deb file that you can install, overwriting the system version:\
    sudo dpkg -i rubygems_1.3.7-1_amd64.deb
  5. Link gem to gem1.8 (see above)

Attached are two (32 and 64 bit) .deb packages from 2011-08-12, kindly built by Kim.

Arne Hartherz
Last edit
About 11 years ago
License
Source code in this card is licensed under the MIT License.
Posted by Arne Hartherz to makandra dev (2010-09-10 20:05)