简体   繁体   中英

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!

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!

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

Don't forget that you may also need to update your Terminal preferences if you've specified a custom shell path there (which I had totally forgotten about): 在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM