Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to open terminal in mac

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!

like image 930
karthiks Avatar asked Oct 25 '16 08:10

karthiks


2 Answers

I found that the above solution did not work in my case. Here is what did work:

  1. Open the default Terminal app, then click on Preferences
  2. change "Shells open with" to /bin/bash
  3. quit terminal
  4. open terminal again, you should be back to a prompt now
  5. Now, run brew upgrade bash from terminal
like image 164
Chad Dienhart Avatar answered Nov 12 '22 05:11

Chad Dienhart


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!

like image 26
karthiks Avatar answered Nov 12 '22 04:11

karthiks