Most of the pages I googled for how to install LibXml Ruby on Windows mention building the required libraries on Windows. Not only that it is a hassle, but I could not make it works either. I finally found a straightforward way and hope it can save you some time.
UPDATE: As you guys pointed out in the comments, I updated the instruction with some more detail and steps that I didn’t mention previously.
Prerequisite: Make sure that you already have
gem install rake
You also probably need Ruby DevKit in order to install native libraries. Follow DevKit Installation Instructions on its wiki page.
As mentioned on LibXml RDoc, you need to download Win32 RubyGem which includes all the required binaries. This way you don’t have to go through the hassle of building all the libraries yourself. To install libxml with prebuilt binaries for Windows, executing the following command: (Thanks @Carl for the suggestion)
gem install libxml-ruby --platform x86-mswin32-60
If there is error at this step make sure you have DevKit installed.
The DLLs must also be available in PATH environment variable. Assuming that your
<ruby-path>\binis already in your PATH (as set by RubyInstaller), copy
<ruby-path>should be something like
Test if everything works by entering
irband require both
irb(main):001:0> require 'rubygems' => true irb(main):002:0> require 'libxml' => true irb(main):003:0>
And that’s it. Now you should be able to use LibXml with your Ruby code!