Unable to open terminal in mac

karthiks picture karthiks · Oct 25, 2016 · Viewed 7.3k times · Source

I am unable to open the terminal or iTerm in my Mac OS, since my last update using brew. Not sure what I upgraded using brew :(

Below is the error message I get when I open terminal. Any help is much appreciated.

dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib
  Referenced from: /usr/local/bin/bash
  Reason: image not found

[Process completed]

Thanks in advance!

Answer

karthiks picture karthiks · Oct 25, 2016

The problem is two fold:

  1. Upgrade bash from brew, using "brew upgrade bash"
  2. The solution (aka step 1) requires Terminal to be opened, which doesn't.

So this is what I did. As it turns out the old bash version is incompatible with the newer upgrade of readline. So the deal is to hunt the location of readline in finder.

In my case, it is at /usr/local/Cellar/readline

Inside the above readline directory I found two directories: "6.3.8" and "7.0".

I renamed "7.0" to "7.0-old"

Created new directory "7.0" and copied contents of "6.3.8" in it.

Hurray! The Terminal now opens-up.

Now, run "brew upgrade bash" from terminal. And in the mean time, restore the readline directory to previous state like below:

  1. Delete "7.0" directory you created
  2. Rename "7.0-old" to "7.0"

You're now good to go. Cheers!