Ruby Gems errors - MacOSX

Today, I started installing tools/utils required for Ruby on Rails. I found a very informative step by step instructions on HiveLogic blog, thanks Dan for posting it.
Entire build/installation process was smooth except a few errors related to ruby-gems.

ERROR: While executing gem ... (NoMethodError) undefined method `refresh' for #<Hash:0x1011570>

Console output:-

$ sudo gem install rails --include-dependencies
ERROR:  While executing gem ... (NoMethodError)
undefined method `refresh' for #<Hash:0x1011570>

Fix:

ERROR: While executing gem ... (Gem::GemNotFoundException) Could not find rails (> 0) in any repository

Console output:-

$ sudo gem install rails --include-dependencies
Bulk updating Gem source index for: http://gems.rubyforge.org
ERROR:  While executing gem ... (Gem::GemNotFoundException)
Could not find rails (> 0) in any repository

Fix:

Update gem and its dependencies, it seems while setting up gems (as instructed in tutorial), setup script is not taking care of it. Run the following command and install all dependencies.

$ sudo gem update

Once gems and it's dependencies are updated/installed, run the command (sudo gem install rails --include-dependencies) again.
I am posting this, even when its posted here and there on different blogs/mailing-lists, because I had to spend sometime to figure it out. Hope it helps.

Technorati tags: , , ,