SUPPORT THE SITE WITH A CLICK

Subscribe Rss:

SUPPORT THE SITE WITH A CLICK

Saturday, January 14, 2012

Up and running with ruby 1.9.3 for rails 4 versions

Rails/master is now 4.0.0.beta and will support only ruby 1.9.3+ as per Riding Rails.
For installing multiple versions of ruby, basically we will go with

As both have its own pros and cons, instead of comparing lets try to work on how to install the ruby versions in both ways.

Rbenv


Steps to install rbenv:
$ cd ~
$ git clone git://github.com/sstephenson/rbenv.git .rbenv

Now the latest version of rbenv will be located in our home directory.Add the following lines of code in ~/.bashrc
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

Restart your shell so the path changes take effect. You can now begin using rbenv.
$ exec $SHELL

Install ruby versions into ~/.rbenv/versions .Now download the ruby 1.9.3 version from ruby-lang, before that create a directory inside ~/.rbenv/versions and place the ruby 1.9.3 source files

$ cd ~/.rbenv/versions
$ mkdir rubysrc
$ cd rubysrc
$ curl -O http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz

Configure the ruby source 1.9.3
$ ./configure --prefix=$HOME/.rbenv/versions/ruby-1.9.3-p0
$ make
$ make install

Now ruby 1.9.3 have been installed in the ~/.rbenv/versions/ruby-1.9.3-p0 folder.

Finally run this command after you install a new version of ruby.
$ rbenv rehash
rbenv rehash will rebuild the shim binaries

RVM


Lets try the ruby installation with RVM. If you have not installed RVM, then find the guides from Installation Guide.

First check the default ruby installed in the system
$ rvm list
rvm rubies
=> ruby-1.9.2-p0 [ i386 ]

For upgrading your older rvm, then try with RVM Upgrade

Now install ruby-1.9.3 in your rvm
$ rvm install 1.9.3-p0
Once the installation over, check the rubies installed in your system now
$ rvm list 
rvm rubies

   ruby-1.9.3-p0 [ i386 ]
=> ruby-1.9.2-p0 [ i386 ]

Guess the post will be useful, for suggestions please comment on this post.

No comments :

Post a Comment