-3

I get this error when starting both iterm and terminal:

dyld: Library not loaded: /usr/local/lib/libgdbm.4.dylib  
  Referenced from: /usr/local/bin/zsh  
  Reason: image not found  

As far as I am tell I am unable to enter any commands into the terminal windows.

I found this thread where someone is getting the same error and is advised to reinstall zsh:

Error loading library in mac terminal

That might work for me to. But where can I execute that?

Another alternative might be if it is possible to switch back to bash.

user1283776
  • 19,640
  • 49
  • 136
  • 276
  • what does `ls -l /usr/local/lib/libgdbm.4.dylib` give you? – Kaveh Vahedipour Jul 07 '18 at 21:22
  • Wrong site. You're looking for [unix.se] or [su] instead. This site is for programming related questions, not general computer or OS support. More information is available in the [help]. – Ken White Jul 07 '18 at 21:22

2 Answers2

7

In iTerm, select Profiles>Open Profile>Default>General>Command>chsh -s /bin/bash

Open a new shell window. Bash will be selected as the default shell.

Change the setting again Profiles>Open Profile>Default>General>Command>Login shell

Now the terminal will work again.

user1283776
  • 19,640
  • 49
  • 136
  • 276
  • 1
    While inventive, I would suggest to first set `/bin/bash` as "Command", open a new window and then run `chsh -s /bin/bash` from there. This allows for more flexibility should any problems with `chsh` arise and you also will know if `/bin/bash` works, before setting it as login shell. – Adaephon Jul 10 '18 at 07:37
  • Given that the terminal emulator itself isn't started from any login shell, I would recommend not messing with `chsh` at all, and just configure iTerm to start whatever shell you want when you open a new window. – chepner Jul 11 '18 at 19:22
  • 1
    This was a life saver for me, thank you :) – Andrew Aug 30 '18 at 05:56
  • Thank you! Life saver!!! – Tarwin Stroh-Spijer Jan 31 '20 at 18:49
1

I just had the same problem. zsh asking for libgdbm.5.dylib, but I did not manage to start terminal by any of the answers I found. So, I went searching for the .dylib, and found ...6.dylib. Here´s what I did, and it worked fine!

Find /..../libgdbm.?.glib.dylib, then copy/past the file. After pasting, rename it to the file, with the number requested. ie. "libgdbm.5.dylib

Jan Magne
  • 11
  • 2