How to install RubyGems on Linux (Ubuntu & Other)

RubyGems is a package management application for Ruby that is used to quickly and easily distribute Ruby/Rails applications and libraries. If you are planning on doing any development in Ruby, this is a must have. RubyGems is for Ruby as apt-get and yum are to Linux operating systems. This article will show you various ways to install it depending on what Linux distribution you are using.

Installing RubyGems Using apt-get on Ubuntu

sudo apt-get install rubygems

Installing RubyGems Using yum

sudo yum install rubygems

Manual Installation Method

wget http://production.cf.rubygems.org/rubygems/rubygems-1.5.0.tgz
tar xvf rubygems-1.5.0.tgz
cd rubygems-1.5.0
sudo ruby setup.rb

That’s all there is to it! You can begin install gems by using the gem install command

See also  How to install Ruby 1.8.7 on CentOS 5.5 Linux

11 thoughts on “How to install RubyGems on Linux (Ubuntu & Other)”

  1. I tried the yum on RHEL6 no go
    I tried the manual installation and I get
    rubygems-2.0.3]# ruby setup.rb
    RubyGems 2.0.3 installed
    ERROR: While executing gem … (Gem::DocumentError)
    RDoc is not installed: no such file to load — rdoc/rdoc
    rubygems-2.0.3]# ls

  2. RubyGems 2.5.1 installed
    ERROR: While executing gem … (NameError)
    uninitialized constant Gem::SourceIndex
    Did you mean? Gem::Source

Leave a Comment