ruby-on-railsrubyhpricot

installing hpricot


I'm trying to install hpricot and am getting the following error. I do have xcode installed but I'm not sure what else I'm missing.

$ gem install hpricot
Building native extensions.  This could take a while...
ERROR:  Error installing hpricot:
    ERROR: Failed to build gem native extension.

        /Users/user_name/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for stdio.h... *** 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.

I also tried nokogiri.

$ gem install nokogiri
Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
    ERROR: Failed to build gem native extension.

        /Users/user_name/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for libxml/parser.h... *** 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.

Solution

  • I don't think hpricot is supported anymore. You should look into nokogiri, it is much faster and is extremely well documented.

    edit: I just checked the hpricot github page (https://github.com/hpricot/hpricot/) and they also suggested you use nokogiri:

    Hpricot has ended. Please consider an alternative like nokogiri.

    edit#2: If you are running into errors installing it, it is likely because you are missing libxml and other libraries which you will need to install through homebrew or macports. All the required libraries and installation instructions can be found here:

    http://nokogiri.org/tutorials/installing_nokogiri.html