Victus Spiritus


Fat Guy in a little coat, Ruby on Windows

29 Jun 2010

There's just too much awesome in Ruby for a clean windows install and development environment.

Just yesterday I started laying the pavement for using Ruby at work. I didn't want to cough up a few hundred for a dev license of Ruby In Steel, a slick Visual Studio plugin.  My first instinct was to dual boot a flavor of linux. Ubuntu's not cleared for work, but Centos (& Redhat) are. The Centos install will have to wait until I torrent the DVD at home later this week (internet at work is low bandwidth). Alternatively, I can go with VirtualBox and emulate my way to happiness.

I remember first setting up Ruby at home on my then Vista system and groaning over failed native gem builds which finally prompted me to jump to Ubuntu (among many other issues). Going through the usual hoops, JDK, Netbeans for an IDE, Ruby one click installer everything went smoothly. Then I hit a road block:

gem install json

ERROR: does not appear to be a repository
ERROR:  could not find gem json locally or in a repository

It couldn't find the json gem (or any others).

Turns out I'm behind a universal proxy, thanks to Google search and stack overflow for clearing up my issue.

Your browser might be using system-wide proxy settings or some sort of automatic configuration. The gem command probably doesn't. I'm behind an university proxy and I can't install/update any gems normally, but can access everything with my browser. To install gems, I normally create a tunnel to my server so I can bypass the proxy server.

This might help you to configure the proxy settings for the gem command:

Here's the fix in a comment under that answer:
gem install --http-proxy http://proxyserveraddress:proxyport _name_of_gem_

Native Gems

Now what I'm really concerned about is building native gems on windows and debugging what goes wrong. Most native C gems leverage gcc on Linux (and lots of other stuff). There's a mingw port of gcc for windows, and there's also cygwin, but I'm leery of trusting either of these alternatives to work flawlessly. Luckily Scott Anderson posted a useful trick for debugging native extensions at (thanks Scott). You gotta love the ability of hackers to figure something out, and share it with the world rapidly.

I'll update my progress and experiences with Ruby on Windows over the next couple of weeks.