Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Does anyone know how to properly uninstall Ruby 1.8.7 and install Ruby 1.9.2 on Ubuntu 11.10?

I have thoroughly searched and none of the tutorials I've found have worked.

Also, I spent a very long time trying to get RVM to work and it just is a pain to use. Additionally, I will have little use for the older version.

Update outputs:

which ruby:

/usr/local/bin/ruby

ls -l /usr/local/bin/ruby:

lrwxrwxrwx 1 root root 16 2011-10-17 21:20 /usr/local/bin/ruby -> /usr/bin/ruby1.8

ls -l /etc/alternatives/ruby:

lrwxrwxrwx 1 root root 18 2011-12-30 17:35 /etc/alternatives/ruby -> /usr/bin/ruby1.9.1

echo $PATH:

/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

By the way, when I look at --config gem, it tells me that there is only one gem, which is /usr/bin/gem1.9.1

share|improve this question
add comment

2 Answers 2

up vote 25 down vote accepted

Is there a problem with having both installed? And using the versions from the repositories? I would install ruby 1.9.2 with:

sudo apt-get install ruby1.9.1-full

And then update the "alternatives" system to use ruby 1.9:

$ sudo update-alternatives --config ruby
There are 2 choices for the alternative ruby (providing /usr/bin/ruby).

  Selection    Path                Priority   Status
------------------------------------------------------------
* 0            /usr/bin/ruby1.8     50        auto mode
  1            /usr/bin/ruby1.8     50        manual mode
  2            /usr/bin/ruby1.9.1   10        manual mode

Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/bin/ruby1.9.1 to provide /usr/bin/ruby (ruby) in manual mode.
$ ruby --version
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]

This will also set the alternatives for erb, irb, rdoc, ri, testrb and the man page. However you need to update the gem command separately:

$ sudo update-alternatives --config gem
There are 2 choices for the alternative gem (providing /usr/bin/gem).

  Selection    Path               Priority   Status
------------------------------------------------------------
* 0            /usr/bin/gem1.8     180       auto mode
  1            /usr/bin/gem1.8     180       manual mode
  2            /usr/bin/gem1.9.1   10        manual mode

Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/bin/gem1.9.1 to provide /usr/bin/gem (gem) in manual mode.

I know, it is confusingly called ruby1.9.1 rather than 1.9.2, some upstream debian packaging thing.

share|improve this answer
add comment

If there really is no reason to keep ruby1.8, I found it easier to remove as follows:

sudo apt-get remove ruby1.8

sudo apt-get install ruby1.9.3
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.