The official Installation documentation states:
sudo port install libxml2 libxslt sudo gem install nokogiri
however I found this not to work for me. The following did work.
$ sudo port install libxml2 libxslt $ sudo gem install nokogiri ERROR: could not find nokogiri locally or in a repository $ sudo gem sources -a http://gems.github.com Bulk updating Gem source index for: http://gems.github.com Updating metadata for 1 gems from http://gems.rubyforge.org $ sudo gem install nokogiri ERROR: could not find nokogiri locally or in a repository $ sudo gem update --system Updating RubyGems... Attempting remote update of rubygems-update Successfully installed rubygems-update-1.3.6 1 gem installed Installing ri documentation for rubygems-update-1.3.6... Installing RDoc documentation for rubygems-update-1.3.6... Updating version of RubyGems to 1.3.6 Installing RubyGems 1.3.6 RubyGems 1.3.6 installed $ sudo gem install nokogiri Building native extensions. This could take a while... Successfully installed nokogiri-1.4.2 1 gem installed Installing ri documentation for nokogiri-1.4.2... No definition for parse_memory No definition for parse_file No definition for parse_with No definition for get_options No definition for set_options Installing RDoc documentation for nokogiri-1.4.2... No definition for parse_memory No definition for parse_file No definition for parse_with No definition for get_options No definition for set_options
I’m not sure why I got those additional errors, however I was able to confirm a valid installation with.
$ irb
>> require ‘nokogiri’
=> true
>> quit
[…] been doing a little work with Ruby, starting with some XHTML parsing with Nokogiri. I’ve just created my first web page using […]