Wednesday, December 19, 2007

Trouble installing new gems? (Part II)

Posted by David

A number of users have reported problems installing the latest Rails gems, especially on Windows. The solution is to upgrade RubyGems to version 0.9.5 1.0.0 before upgrading. You can check your RubyGems version by:

gem —version

If 0.9.5 1.0.0 is not the answer, do (you may not need to prefix with sudo, on OS X you do, some ’nix distributions too, but not Windows):

sudo gem update —system

Then do:

sudo gem install rails

And while this should no longer be an issue, you can always install Rails from the Rails gem repository if the official one is having issues for whatever reason (such as right after a new release where the mirrors have some times not caught up and are spewing 404 errors):

sudo gem install rails —source

If you want to use SQLite3 for a new application, first make sure that you have SQLite3 itself installed. If not, you can get it from the SQLite download page. Then make sure you have the Ruby bindings installed (the gem is called sqlite3-ruby). If you don’t, just:

sudo gem install sqlite3-ruby

If you don’t want to use SQLite3, that’s fine. Just do “rails -d mysql myapp” when creating your new application to get MySQL preconfigured. Or “rails -d postgresql myapp”. Or any other adapter you might want to use that you have installed, like Oracle, SQL Server, or what have you. The only thing we changed was which database adapter would be preconfigured if you didn’t explicitly set which to use.

UPDATE: RubyGems 1.0.0 is now out, which should fix the problems with Mongrel and Windows.