I just installed ruby using apt-get with the following command:

sudo apt-get install ruby1.9.1-full

But when I try to do sudo gem install ... it says that I have not installed gems and that I shoud get rubygems1.9.1, I tried to do so but it said I already have it installed (I believe they are included in ruby1.9.1).

I believe its a problem relating only to ruby because I never had issues installing anything through apt-get and then not getting it recognized. I tried login out, rebooting but no luck. I'm on 10.10 by the way.

Does anyone know what could be wrong?

Thanks in advance!

2 Answers 2


You have two options.

You can use a script that will do this for you, or you can follow the guide manually - they'll both have the same results, and they'll both do the same thing, the only difference is that the script won't require you to copy/paste anything after you select the method of installation in the script itself.

Keep in mind that the script will update your system and install various dependencies.You will after be asked if you want to install it system-wide [1] or for your local user [2] - if you want to use the same basic method as the guide below, choose [2] To use this script, you simply run the following:

wget --no-check-certificate https://raw.github.com/joshfng/railsready/master/railsready.sh && bash railsready.sh

This is a different way of installing Ruby and gems that while it doesn't necessarily fix your problem per se, it does provide a way for you to get Ruby working on your computer.

  1. Install git and curl. To do that, open a terminal by hitting "Alt-F2", and typing gnome-terminal into the resulting dialog. Next, hit "enter" to launch the terminal. Now, copy and paste the following line into the terminal.

sudo apt-get update && sudo apt-get install git curl -y

Hit enter, and now you can just sit back and relax for a few minutes while it installs.

Download and install RVM. To download and install RVM, use the following line of command-line magic.

 bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

Now that you've got that installed, you have to add it to your terminal's path, which tells the terminal where to find all of the commands. To do that, type "gedit ./.bashrc" into your terminal, then past the following line down at the very bottom.

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.

Now, close your terminal, and open a new one by typing "Alt-F2" and typing in gnome-terminal.

Now you're ready to install ruby itself. But before you can do that, you have to install all the stuff that you need for RVM to install Ruby. To do that, you have to run the following command.

sudo apt-get update && sudo apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev -y

You're probably asking yourself "What the heck does all THAT do?!!". Well, here's the answer: Mostly has to do with compiling ruby, which you'll do in a second.

To install ruby 1.9.2 (Which is the most recent version as of writing), you need to type the following in your command prompt.

rvm install 1.9.2

hit enter, and then go grab a snack. This step is going to take awhile.

Now that you've taken your last walk for awhile (Or whatever the heck you just did while ruby compiled), it's time to create a gemset.

One of the nicest things about RVM is that it lets you have multiple versions of Ruby installed, something that you'll want to use as you get further along in programming Ruby. So, here's how to create a gemset.

rvm --create use 1.9.2@first-gemset && rvm --default use 1.9.2@first-gemset

Congrats! Now, you can test and see if RVM did it's job by typing in the following line.

ruby -v

It should spit out something like this:

ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]

Congrats! You've got rvm and Ruby installed successfully. Now, you can install Rails (Or any gem) by typing in this:

gem install <gem name>

Note: replace with the name of the gem you're trying to install

  • No need for autoconf IIRC, since the end user should never need it.
    – mathepic
    Mar 25, 2011 at 0:41
  • @mathepic - end user doesn't, but for some reason rvm does. Don't ask me why. (I got that list after I ran rvm notes after I set my paths. It detected I was on Ubuntu/Linux, and told me to install those. So I stuck them in the answer).
    – jrg
    Mar 25, 2011 at 2:12
  • Thanks, I don't what I just did with all that but it worked lol. Mar 25, 2011 at 3:03
  • Pretty much, what you did was you installed a version of Ruby just for your user using rvm (rvm.beginrescueend.com). And you're welcome. Glad to help. :)
    – jrg
    Mar 25, 2011 at 8:07

Ruby 1.8 is the default version packaged for Ubuntu, and the gem command is provided by a package rubygems1.8. The package that you installed contains the gem1.9.1 command (notice the suffix), which should be used in order to install gems for Ruby 1.9.

  • Except it doesn't, since gem1.9.1 (In theory at least) requires ruby1.9.1.
    – jrg
    Mar 24, 2011 at 23:53
  • Yes, and what's the problem with that? The OP explicitly mentioned that he has ruby1.9.1 installed. Mar 25, 2011 at 8:18
  • Oops. I didn't read the question again last night. I really need to stop watching AU when I'm tired. Sorry.
    – jrg
    Mar 25, 2011 at 8:20
  • No problem, your answer is better anyway :) Mar 25, 2011 at 8:31
  • But it didn't solve the problem - it just provided a (very lengthy) workaround. Thanks though. Yours was good as well. :)
    – jrg
    Mar 25, 2011 at 8:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .