Posts Tagged ‘ Ruby

Installing Rails 3 beta 2 using rvm

Rails 3 beta 2 was released at April 1. From the blog post at Riding Rails, it seems that this beta 2 break lots of things.

Note that Ruby 1.8.7 p248 and p249 has marshaling bugs that crash both Rails 2.3.x and Rails 3.0.0. Ruby 1.9.1 outright segfaults on Rails 3.0.0, so if you want to use Rails 3 with 1.9.x, jump on 1.9.2 trunk for smooth sailing.

Both Ruby 1.8.7 p248 and p249 crashed and Ruby 1.9.1 have segfaults problem. So it’s time to move on to Ruby 1.9.2. Ruby 1.9.2 is still in the development phase but it will be ready in 4 months. The scheduled release date is 31 July 2010. Let’s install rvm with ruby 1.9.2 to try out the newly released Rails 3 beta 2.

Install rvm

$ mkdir -p ~/.rvm/src && cd ~/.rvm/src && rm -rf ./rvm/ && git clone
git://github.com/wayneeseguin/rvm.git && cd rvm && ./install

The installation will take a while, and after rvm is installed, you’ll need to edit your .bashrc and .bash_profile. Append the following at the end of your .bashrc/.bash_profile:

if[[ -s /Users/stevew/.rvm/scripts/rvm ]];
    then source /Users/stevew/.rvm/scripts/rvm;
fi

Install Ruby 1.9.2 head, remember to install the head of ruby 1.9.2 branch, not the preview1 because ruby 1.9.2 preview1 doesn’t work with tzinfo gem, you will have problem like this

.rvm/gems/ruby-1.9.2-preview1/gems/tzinfo-0.3.18/lib/
tzinfo/timezone.rb:108:in `rescue in get’: protected method 
`setup’ called for #<tzinfo::datatimezone:0x000000024b7cb8> 
(TZInfo::InvalidTimezoneIdentifier)
$ rvm install 1.9.2-head

It will take a while to download and compile the ruby 1.9.2. once completed you can run the ruby command to verify the ruby version.

$ rvm 1.9.2-head
$ ruby -v
ruby 1.9.2dev (2010-04-07 trunk 27247) [x86_64-darwin10.3.0]

Set the default ruby version to ruby 1.9.2-head

$ rvm 1.9.2-head --deafult

Install Rails3 beta2, you don’t need to use sudo here to install gem beacuse all gems will install in your local home directory

$ gem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n
$ gem install rails --pre

Install sqlite/mysql gems for rails

$ gem install sqlite3-ruby
$ gem install mysql -- --with-mysql-dir=/usr/local/mysql

Just create a new project as usual and that’s it. you are now ready to try out Rails 3 beta 2.