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

  • How did you install the newer version? Macports? Homebrew? Also, which version of Xcode do you have installed? And did you install the command line tools that are optional in the Xcode downloads section? Knowing this will give us a little more insight on how to help you out. – de_an777 Jun 20 '12 at 14:05
  • Yes,libxml2 was installed using ./configure and make. The problem was that there was Python-2.7.3 dependency for it, which was ignored by me :( .Now I reinstalled Lion and fixed the problem – Shailesh Kalamkar Jun 21 '12 at 13:20

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .