Can't find ruby or gem commands after doing ruby-install in Ubuntu

5.6k Views Asked by At

I have installed ruby 1.9.3 in my Ubuntu 12.04 machine following the instructions in https://github.com/postmodern/ruby-install and executing the following command:

sudo ruby-install ruby 1.9.3

I was assuming this would link from my /usr/bin or somewhere else visible from my path ruby or gem, but it doesn't. When I try for example: gem install bundler, I get:

sudo: gem: command not found

It also can't find ruby when I try ruby -v.

If I install with sudo apt-get install ruby1.9.3, I'm able to execute both ruby and gem:

$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
$ gem -v
1.8.11

I was expecting from ruby-install the same output I got from apt-get. Am I looking in the wrong place? How do I run ruby and gem after installing with ruby-install?

I know there are other installers for ruby like rvm and rbenv, but I'm following some installations instructions and they clearly instruct to use ruby-install.

Thanks in advance!

1

There are 1 best solutions below

0
On

OK, found the answer.

After running

sudo ruby-install ruby 1.9.3

the last line from the log is:

>>> Successfully installed ruby 1.9.3-p547 into /opt/rubies/ruby-1.9.3-p547

Which I have no excuse for not paying attention to since it's in bold colourfull letters.

Erm, anyway, adding /opt/rubies/ruby-1.9.3-p547 to the PATH makes ruby and gem work.

export PATH=$PATH:/opt/rubies/ruby-1.9.3-p547/bin