Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update ruby on linux (ubuntu)?

I'm newbie on both ruby and linux, so I'm sure this is trivial but I don't know yet. I currently have ruby 1.8.7 installed and I want to update it to ruby 1.9. How can I do that?

like image 538
eKek0 Avatar asked Sep 10 '09 03:09

eKek0


People also ask

Where is Ruby installed on Ubuntu?

One way open the terminal window (sometimes called a "shell" or "bash shell") is to select Applications > Accessories > Terminal. Run the command which ruby. If you see a path such as /usr/bin/ruby, Ruby is installed.

Does Ubuntu have Ruby?

The easiest way to install Ruby on your Ubuntu system is through the apt package manager. At the time of writing, the version in the Ubuntu repositories is 2.5. 1 which is the latest stable version of Ruby.


2 Answers

sudo apt-get install ruby1.9 

should do the trick.

You can find what libraries are available to install by

apt-cache search <your search term> 

So I just did apt-cache search ruby | grep 9 to find it.

You'll probably need to invoke the new Ruby as ruby1.9, because Ubuntu will probably default to 1.8 if you just type ruby.

like image 65
Mark Rushakoff Avatar answered Sep 28 '22 06:09

Mark Rushakoff


There's really no reason to remove ruby1-8, unless someone else knows better. Execute the commands below to install 1.9 and then link ruby to point to the new version.

sudo apt-get install ruby1-9 rubygems1-9 sudo ln -sf /usr/bin/ruby1-9 /usr/bin/ruby 
like image 25
Chris Avatar answered Sep 28 '22 07:09

Chris