Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
The Nokogiri warning I'm seeing when using pg and nokogiri together.

To replicate the warning:

$ mkdir /tmp/pg-nokogiri-test
$ cd /tmp/pg-nokogiri-test

$ cat > Gemfile
source :rubygems

gem 'pg'
gem 'nokogiri'

$ bundle install --path=./.bundle/gems --binstubs=./.bundle/bin
Fetching gem metadata from
Installing nokogiri (1.5.2) with native extensions 
Installing pg (0.13.2) with native extensions 
Using bundler (1.1.0) 
Your bundle is complete! It was installed into ./.bundle/gems

$ bundle console
WARNING: Nokogiri was built against LibXML version 2.7.8, but has dynamically loaded 2.7.3

As far as I can tell, postgres (installed with homebrew) is compiled against/using libxml 2.7.8:

$ which postgres
$ otool -L /usr/local/bin/postgres
    /usr/local/Cellar/libxml2/2.7.8/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.8.0)
    /usr/lib/libssl.0.9.8.dylib (compatibility version 0.9.8, current version 44.0.0)
    /usr/lib/libcrypto.0.9.8.dylib (compatibility version 0.9.8, current version 44.0.0)
    /System/Library/Frameworks/Kerberos.framework/Versions/A/Kerberos (compatibility version 5.0.0, current version 6.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)

I've explicitly compiled Nokogiri against libxml 2.7.8:

$ cd /tmp/pg-nokogiri-test
$ irb
>> require 'bundler/setup'
=> true
>> require 'nokogiri'
=> true
=> {"warnings"=>[], "nokogiri"=>"1.5.2", "ruby"=>{"version"=>"1.9.3", "platform"=>"x86_64-darwin11.2.0", "description"=>"ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]", "engine"=>"ruby"}, "libxml"=>{"binding"=>"extension", "compiled"=>"2.7.8", "loaded"=>"2.7.8"}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.