Unfortunately for me, Windows remains a daily fact of life, and as much as I wish I could use OSX or Linux instead, I can't. Such is working life. So I feel it's a shame that Windows remains very much a third class citizen in the Ruby world.

I fairly recently came across the RubyInstaller project, and excellent effort to update the ageing 1.8.6 One-Click installer still offered on the official Ruby download page. They now offer two new "Technology Preview" installers for Ruby; one for 1.8.6 and one for 1.9.1.

Although there is perhaps one step back with these installers, there are a lot of steps forward, and I'm very glad someone is making a decent effort on Windows. I particulary like that it doesn't modify the windows PATH environment variable, rather it offers a special shortcut to a Command Prompt that sources the Ruby install. This means you can easily install both Ruby 1.8.6 and 1.9.1 and have command prompts open for both and you can just type "ruby" or "irb" in both and it works rather than having to type "ruby19" or "irb19", etc. Mind you, there is also a shortcut staright to IRB and a built-in gems documentation local web server you can start up. Nice.

It was a combination of the one-step back and trying Ruby 1.9.1 again that snagged me though, and things that "just worked" under the old One-Click installer weren't working under the new RubyInstaller, specifically trying to install roo, led to an error installing libxml-ruby, even after I'd installed the Developer Kit (you need that for Hpricot); I was getting the following:

Building native extensions. This could take a while...
ERROR:  Error installing libxml-ruby:
ERROR: Failed to build gem native extension.

C:/Ruby19/bin/ruby.exe extconf.rb
checking for socket() in -lsocket... no
checking for gethostbyname() in -lnsl... no
checking for atan() in -lm... yes
checking for inflate() in -lz... no
checking for inflate() in -lzlib... no
checking for inflate() in -lzlib1... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby19/bin/ruby
--with-iconv-dir
--without-iconv-dir
--with-iconv-include
--without-iconv-include=${iconv-dir}/include
--with-iconv-lib
--without-iconv-lib=${iconv-dir}/lib
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--with-socketlib
--without-socketlib
--with-nsllib
--without-nsllib
--with-mlib
--without-mlib
--with-zlib
--without-zlib
--with-zliblib
--without-zliblib
--with-zlib1lib
--without-zlib1lib
extconf failure: need zlib


Gem files will remain installed in C:/Ruby19/lib/ruby/gems/1.9.1/gems/libxml-rub y-1.1.3 for inspection.
Results logged to C:/Ruby19/lib/ruby/gems/1.9.1/gems/libxml-ruby-1.1.3/ext/libxm l/gem_make.out

The answer was on the libxml page:

If you are running Windows, make sure to install the Win32 RubyGem which includes an already built binary file

So I downloaded the libxml-ruby-1.1.3-x86-mswin32-60.gem and installed locally and all was well. (Note that under Ruby 1.8.6, rubygems is sensible enough to install this version, not so under 1.9.1)

However, 1.9.1 still remains a pain in the arse on Windows, I think mainly because of gems.

Trying to require 'roo' under 1.9.1 and 1.8.6 lead to an error because it couldn't find "libiconv-2.dll" and "libxml2-2.dll". Ok, fair enough, they are in the \libxml-ruby-1.1.3-x86-mswin32-60\lib directory, so it should be able to find them, but it is easier enough to copy them to the Ruby/bin directory. But then, under 1.9.1, I got an error about not being able to find "msvcrt-ruby18.dll", which as far as I can tell means the gem is not ready for Ruby 1.9.1.

So I am back to Ruby 1.8.6 again. And all is well. Ruby 1.9.1 remains, once again, a distant dream on Windows.

EDIT: Apr-2011 I've just gone and tried again, and at first I was unsuccessful, but then I found this page: Gem List which lists which gems have been successfully installed using the new DevKit. It has a note against libxml-ruby to use gem install --platform=mswin32. And this worked fine for me (Windows XP, Ruby 1.9.2).

So, based off the DevKit wiki, what you'd expect to work: gem install libxml-ruby --platform=ruby doesn't, but using gem install -r libxml-ruby --platform=mswin32 does work.