Can I install gems with apt-get on Ubuntu?

77,819

Solution 1

First, download *.tar file, unpack this file, then go to rubygems directory in your console, and type

ruby setup.rb

That's it :)

Solution 2

Ubuntu now have rubygems as a package

For Ubuntu 12:

sudo apt-get install rubygems

For Ubuntu 14.04:

sudo apt-get install rubygems-integration

Solution 3

On Ubuntu 16.04 and Ubuntu 18.04, both sudo apt-get install rubygems and sudo apt-get install rubygems-integration failed for me. Instead, I had to do this:

sudo apt-get install ruby-dev

Solution 4

If on Ubuntu 14.04 try below

sudo apt-get install rubygems-integration

Solution 5

If you install the full ruby application set with

sudo apt-get install ruby-full

You will get gems and much more by default. Tested on Ubuntu 16, it could also work on other version.

Share:
77,819

Related videos on Youtube

Genadinik
Author by

Genadinik

Thank you to everyone who has helped me. I am extremely appreciative of the amazing people on StackOverflow who have helped me :) I currently run https://www.problemio.com under which I offer mobile apps, books, coaching, and online courses, and even a B2B course licensing business: https://www.problemio.com/udemy/white-labeling-or-buying-udemy-courses.html I also run a funny t-shirt store: https://www.waveifyoulike.com

Updated on June 11, 2020

Comments

  • Genadinik
    Genadinik almost 4 years

    I am new to Ruby and just diving in. The Ruby tutorial says I should get the packaging system from here: http://rubyforge.org/frs/?group_id=126

    I am on Ubuntu Linux. The page has a .tar and a .gem option for downloading. Which should I download?

    Also, are gems exactly analogous to Java jars? And why do I need the gem packaging system if I can just download gems one by one as they are needed?

    • PJP
      PJP about 13 years
      I'll highly recommend using RVM to create a developer's sandbox on your host, unless you intend to use it as a production server. RVM is rapidly becoming the method of choice for installing Ruby and managing gems on MacOS and Linux systems. It's an easy install, just read through the directions first and follow them. Once RVM is installed on your machine type rvm notes and follow those directions. At that point you should be ready to let it install Ruby using rvm install 1.9.2 followed by gem install gemname, for whatever gems you want.
  • Genadinik
    Genadinik about 13 years
    btw, into what directory is it best practice to unpack the tar file? Thanks! :)
  • Mike
    Mike about 13 years
    It doesn't matter, after installation you can remove rubygems directory.
  • fjuan
    fjuan over 9 years
    Nice update, although the question is old and its reference to rubyforge.org doesn't work