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 #

Console output:-

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

Fix:

  • Remove /usr/local/lib/ruby/gems/1.8/source_cache and ~/.gems directories.
  • Run the command (sudo gem install rails –include-dependencies) again.

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: , , ,

  • Tim

    Thanks so much, I received the GemNotFoundException, and the sudo gem update did the trick.