Rails on Windows, gems doesn’t install, can’t update

Let me first show you this:

C:\workspace>rails -v
Rails 2.3.0

(Me watching Diggnation one time too many)

So Rails or more precise gem installer sucks in Windows. Most of the time people have problem with sqlite gem but as it happens, others can make your life hard as well. Problem is that when specific Windows version of gem is not available, it tries to build one and this fails miserably. Now the real issue here is that it stops installing and updating other gems so you get stuck over some gem you barely use. Solution would be that those gems that can’t be installed get skipped and this small ruby script would do the trick (found it in ruby-forum.com after reading about it on Stack Overflow):

Create a file update-gems.rb and paste following (one line):

`gem.bat outdated`.split(/\n/).map{|z|z.scan(/^[^[:space:]]+/)}.flatten.each{|z| `gem.bat update #{z}`}

run it with

ruby update-gems.rb

and that is it, your problems solved.


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s