MacOS – Problem with libxml2-2.8.0 version on OS X Lion

developmenterrormacos

I have installed OS X Lion and I was trying to resolve error libxml2 missing for Ruby programming purpose. I tried to install latest version of Libxml2 that is libxml2-2.8.0

Because of incompatibility of this version Mac is throwing errors while opening XCode, Chrome and some other application with the error.

Dyld Error Message:
Library not loaded: /usr/lib/libxml2.2.dylib
Referenced from: /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
Reason: no suitable image found.  Did find:
   /usr/lib/libxml2.2.dylib: mach-o, but wrong architecture
   /usr/local/lib/libxml2.2.dylib: mach-o, but wrong architecture
   /usr/lib/libxml2.2.dylib: mach-o, but wrong architecture

What should I do ? How should I remove libxml2 2.8.0 version.?

Please reply

Best Answer

You can do either of

  1. remove /usr/local/lib/libxml2.2.dylib, copy a working libxml2.2.dylib from another Mac with the same OS X version and recreate the symlinks to look like the directory listing below

  2. reinstall OS X Lion on top of the existing installation and reapplying all the system updates.

  3. get libxml2.2.dylib from your backup and apply option 1

PS: I managed to do the same thing with one of the more essential libraries a few months ago, leaving only option 2 (because nothing useful worked anymore). With hindsight I probably could have booted from DVD to apply option 1, but I would still have needed a trusted source for the library because the DVD was for 10.7.0.


pse@Fourecks:~$ ll /usr/lib/libxml2.*
lrwxr-xr-x  1 root  wheel       15 Feb 12 11:51 /usr/lib/libxml2.2.7.3.dylib@ -> libxml2.2.dylib
-rwxr-xr-x  1 root  wheel  2321840 May 10 20:34 /usr/lib/libxml2.2.dylib*
lrwxr-xr-x  1 root  wheel       15 Feb 12 11:51 /usr/lib/libxml2.dylib@ -> libxml2.2.dylib