I was trying to get wine working on my Mac. It’s been erroring about something or another so I ran winedbg to see what it was complaining about. The last function on the callstack seemed to be in the libcrypto.0.9.7.dylib library in the /usr/lib directory so in my infinite wisdom I renamed it to see if it was loading a different one from somewhere. Big mistake…
I was left in a position where I could no longer sudo to rename it back. I had no luck from Finder either and I couldn’t open new Terminal sessions. I decided to reboot in safe mode by holding down shift while rebooting to see if I could repair the damage from there but my system just wouldn’t come up – I was left staring at the Apple logo.
In case you should ever find yourself in this position, don’t panic too much – After much panicking myself, I managed to fix it by doing the following. Bear in mind at the time of writing I use Leopard so things may be a little different in future OS X versions.
- Locate your OS X installation disk 1 and pop it in the DVD drive.
- Reboot while holding the C key down to force your Mac to boot from the DVD drive.
- It’ll load up and ask you what language you’d like to use. Pick one (preferably one you can understand lol).
- The next screen is all about reinstalling. That’s a last resort really because we can fix things from here. On the Utilities menu you should see Terminal. Choose it and the Terminal will open with a bash shell.
- Bear in mind that you’ve not booted from your hard disk so the directory structure will look different to what you’re used to. Change directory in to /Volumes and then in to your hard disk, possibly called “Macintosh HD” unless you’ve changed it.
- Now you’re actually looking at your hard disk and should be able to change directory in to usr/lib and mv the file back to it’s original name. Just to clarify, you should not be in /usr/lib. You should be in /Volumes/Macintosh HD/usr/lib.
Good luck!