This came up recently in the context of OSX 10.5,
libxml2. The issue is that the shipped
libxml2 for Leopard is old, and when using
rvm with a compiled
ruby which uses the system installed
nokogiri will give this friendly message:
HI. You’re using libxml2 version 2.6.16 which is over 4
years old and has plenty of bugs. We suggest that for maximum
HTML/XML parsing pleasure, you upgrade your version of
libxml2 and re-install nokogiri. If you like using libxml2
version 2.6.16, but don’t like this warning, please
define the constant
before requring nokogiri.
This becomes a problem when you have explicitly added a newer version of
libxml2, for example with Homebrew , and
ruby is not finding it.
OSX handles its shared library load paths this way1:
ruby find your
libxml2, set the DYLD_LIBRARY_PATH environment variable to include the path to where it is installed, for example
/usr/local/lib. In my case, I set it like so:
% export DYLD_LIBRARY_PATH=/usr/local/lib
1 This is a first order approximation, there are plenty of missing nuances here.
2 This is a colon seperated path variable.
3 Also a colon separated path variable; the default is