Ok, so here is the deal. I was working on two projects at the same time and I mistakenly:

rm -rf /usr/lib/libxml2.2.dylib

I have another copy of libxml2 thankfully (the other project, homebrew install libxml2). That copy is in /usr/local/opt/libxml/lib. For the life of me I can not get cp /usr/local/opt/libxml2/lib/libxml2.2.dylib /usr/lib to work. It always says:

/usr/lib/libxml2.2.dylib Read-only Filesystem

Please can anyone help? I have tried cp -S, -R, -F and I can't get it to cp or mv. I just need to write that lib back and I should be good to go. I don't know what I was thinking when I did that. Running Yosemite 10.10.2, Late-2011 mbp. Libxml2 from homebrew is 2.9.2 I think if it makes a difference.

  • The version of libxml in Homebrew is I think different from the one in OS X - you need to reinstall OS X and not do that link – mmmmmm Jan 30 '15 at 11:07
  • Um ... you did try to use sudo, didn't you? – oarfish Jan 30 '15 at 11:12
  • You mean there is no way I can get a libxml2 from another Yosemite? I am forced to reinstall? Yes, I did use sudo – RinconRex Jan 30 '15 at 11:18
  • @RinconRex try /sbin/mount -uw / before copying. In single user mode the file system is mounted read-only. Your mileage starting OS X with the homebrew libxml2.2dylib may vary... – klanomath Jan 30 '15 at 11:32
  • OMG You are a genius sir. It worked! I tried mount -o remount,rw / but nothing. Yours did the trick, back up and running! – RinconRex Jan 30 '15 at 11:38
  • Enter /sbin/mount -uw / and copy 'libxml2.2.dylib' from '/usr/local/opt/libxml/lib/' to '/usr/lib/'

  • Restart your Mac and restore the original file:

  • Download Pacifist (i think it's a 14-day trial) and the Yosemite System Installer

  • Right-click the 'Install OS X Yosemite.app' -> 'Show Package Contents'

  • Mount ./Contents/SharedSupport/InstallESD.dmg

    enter image description here

  • Open the mounted 'OS X Install ESD'

  • Open ./Packages/BaseSystemBinaries.pkg with Pacifist

  • In the new Pacifist-window navigate to 'Content of BaseSystemBinaries/usr/lib/libxml2.2.dylib'

  • Right-click libxml2.2.dylib and install it

  • Restart your Mac

| improve this answer | |
  • I am in single user mode. I don't think I can right click. Maybe in recovery? – RinconRex Jan 30 '15 at 11:20
  • If I can do it from single user with no libxml then yes, my gf has a macbook air – RinconRex Jan 30 '15 at 11:22
  • Ok, well I have to wait until my gf gets home. Any tips to make the ssh login smooth? I'm in Berlin btw so she just left for work, no rush on any of this. I have all day. – RinconRex Jan 30 '15 at 11:32
  • I don't see Shared Support anywhere – RinconRex Jan 30 '15 at 11:51
  • Mine has no shared support, I have the exact same window as you but not that folder. Just checked the zip too, no shared support, am I downloading the wrong copy? I have 3.2.17 – RinconRex Jan 30 '15 at 12:07

You must log in to answer this question.

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