GG's Blog

A blog about Software design, development and random things GG do.

Upgrade Ruby Version on Mac OSX

with one comment


RVM (Ruby Version Manager) is the Standard for upgrading your Ruby installation on OSX: https://rvm.io

To get started, open a Terminal Window and issue the following command:

\curl -L https://get.rvm.io | bash -s stable --ruby

Do not remove ‘\’ before curl, since it is added to ignore any alias created with name curl. It might fail due to absence of HomeBrew, So Install brew by running

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

( you will need to trust the RVM Dev Team that the command is not malicious – if you’re a paranoid penguin like me, you can always go read the sourcehttps://github.com/wayneeseguin/rvm )

rvm list known

( shows you the latest available versions of Ruby )

rvm install ruby-<version>

Above command might fail with following error:

Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.7/x86_64/ruby-<version>.
Continuing with compilation. Please read ‘rvm mount’ to get more information on binary rubies.
Installing requirements for osx, might require sudo password.
Skipping `brew update` make sure your formulas are up to date.
Cowardly refusing to continue, please read ‘rvm autolibs’.

Which is an issue with the autolib status and error message is misleading and under an upgrade. Run following command to install latest stable version(specific version can be mentioned) with autolibs enabled(4):

\curl -L https://get.rvm.io | bash -s stable –rails –autolibs=enabled #–rails is additionally to install rails also, else just add –ruby

If above command fails during configure, you might be missing gcc and other developer tools which are packaged with xcode. Install xcode command line tool from apple developer portal, rerun above command and you are good to go.

Use a specific version

rvm use ruby-<version>

Upgrading Ruby Version on Ubuntu

Upgrading ruby on ubuntu is quite simple. Search for latest ruby package available:

apt-cache search ruby

Install latest stable ruby package(assuming 1.9.3):

sudo apt-get install ruby1.9.3 rubygems1.9.3

Point to the latest installed ruby(there is no harm in leaving old ruby packages installed)

sudo ln -sf /usr/bin/ruby1.9.3 /usr/bin/ruby
sudo ln -sf /usr/bin/rubygems1.9.3 /etc/alternatives/gem

If latest ruby is not part of the package repository, follow stackoverflow answer to install latest stable version of Ruby.
 
 

Written by techespanto

March 29, 2013 at 1:32 am

Posted in Ruby

One Response

Subscribe to comments with RSS.

  1. This blog was really helpful. Good work.

    Rahman

    August 13, 2013 at 6:14 pm


Leave a comment