Bye Bye Bash
Posted on March 03, 2010 at 12:34 AM
What do you do when you bring up your OSX terminal and see this…
Last login: Tue Mar 2 23:11:45 on ttys000
dyld: Library not loaded: /opt/local/lib/libreadline.5.2.dylib
Referenced from: /opt/local/bin/bash
Reason: no suitable image found. Did find:
/opt/local/lib/libreadline.5.2.dylib: mach-o, but wrong architecture
[Process completed]
This is bad. It means that bash is broken. What’s worse, I couldn’t find any information on how to fix it. I’m pretty sure this was broken when I upgraded subversion using mac ports. A quick port deactivate/clean/install on readline should do the trick. No problemo. Except, can’t do that without a shell. Since I can’t get to the command line, I can’t change my default shell. Luckily, Terminal has a trick up it’s sleeve for just such an occasion. If you open up the preferences for Terminal, you can tell it to open up an alternate shell. Under the Shell settings ‘tab’ check the Run Command checkbox, enter /bin/ksh (for Korn shell) and remember to uncheck Run Inside Shell (otherwise it will just fail because, remember, your default shell is kaput).

This at least gets you to a working, albeit slightly less comfy shell. But, you can now begin the task of reconstituting bash. Long story short, trying to fix readline alone didn’t solve anything, so I went nuclear and decided to let port try and upgrade bash.
sudo port upgrade bash
A little risky, I will admit. But, if this didn’t work the next step was restoring from Time Machine (which I have done several times in the last week, so I wasn’t really deterred by that prospect). If you are following along at home due to similar problems, now would be a good time to consider how recent your backup is and how confident you are in the ability to restore from it before you unleash mac ports on a major system component. The last time I let port try and upgrade everything, it went very, very badly and led to one of the aforementioned restoration events. This time I got lucky, port build cleanly and bash was restored in full. I count myself lucky.
Comments
There are 0 comments on this post. Post yours →
Post a comment
Required fields in bold.