How To

Updating The Alternatives

If you have two Y’s installed (different versions) and facing some problem with having both installed? Or using the versions from the repositories?

You can use the following steps to update the alternatives system to use Y.x version. I used this for Ruby, so following steps will be doing it for Ruby.

  

Find the alternatives present:


sudo update-alternatives --config ruby

#You may get something like this, I copied this from somewhere.

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.

 
 
 

Tip: To simply install Ruby may be 1.9.3

You can do


sudo apt-get install ruby 1.9.3

cd /etc/alternatives

sudo ln -sf /usr/bin/ruby1.9.3 ruby

Advertisements

One thought on “Updating The Alternatives

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s