سؤال

As "Reason: Incompatible library version: nokogiri.bundle requires version 11.0.0 or later, but libxml2.2.dylib" mentions, there is a compatibility issue in using Nokogiri with versions of libxml2 >= 2.9.0.

I see below that I have libxml2 v2.2 installed locally, so Nokogiri works without issue. However, some other team members have newer versions >= 2.9.0 which are causing issues:

jeeves:~ $  ls -l /usr/lib/libxml*
-rwxr-xr-x  1 root  wheel  2390032 Jun 26 06:36 /usr/lib/libxml2.2.dylib
lrwxr-xr-x  1 root  wheel       15 Jun 26 06:42 /usr/lib/libxml2.dylib -> libxml2.2.dylib

I want to install the latest libxml2 version (2.9.1) but don't want to remove my existing 2.2 version. In other words, I want to have multiple versions installed locally and be able to switch back and forth between them.

I noticed the /usr/lib/libxml2.dylib can be re-pointed (symlinked) to whatever version I want to use. Is it as simple as downloading the latest *.dylib file and repointing /usr/lib/libxml2.dylib? I'd imagine there's more than just the one file to install.

Thanks!

هل كانت مفيدة؟

المحلول

If you want something a little more contained, you could install the non-system version of libxml2 via Homebrew.

By default, Brew installs library-only packages outside of the library search path into /usr/local/Cellar, so that you have to specify them explicitly via

gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/<version>/include/libxml2

, but you can link (and unlink) any library into the search path at with brew link, making it the default.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top