I've got this message in Terminal.app at startup

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

[Process completed]

I have found some links regarding this issue.

But the problem is that I can't run terminal app, so it's not possible for me to try brew doctor or other options.

It's not possible to reinstall Terminal app, other terminal app (iTerm2) is not running at all.

Is there a way to fix this problem without reinstalling OSX?

  1. Choose Shell → New Command….

  2. Run chsh -s /bin/bash and make sure to deselect ‘Run command inside a shell’.

  3. Enter your user account password at the prompt to change your shell back to /bin/bash.

| improve this answer | |
  • 2
    A similar solution can be done from iTerm2. Add a new "Profile", make sure the "Command" is set from "Login shell" to "Command" and enter "/bin/sh" as the command (or /bin/bash, anything but zsh). That let's you get back into the command line, and you can then follow @Robert J Berger's solution below. – Unapiedra Jul 5 '18 at 19:00
  • I was able to do this and then the steps from the "brew" answer followed by changing my shell back to zsh. – Bill Mote Jul 13 '18 at 15:17

Are you running zsh? I'm seeing a similar problem while running iTerm2. It seems to be a problem with zsh and not with Terminal or iTerm2. Just started happening to me.

If you had installed zsh with Homebrew and you are having that problem, what worked for me was:

brew reinstall zsh && brew unlink zsh && brew link zsh

If you didn't install zsh with Homebrew, then ignore this :-)

| improve this answer | |

Easier I think:
Download iTerm2 and brew update && brew upgrade zsh worked for me ;-)

| improve this answer | |
  • It's easy when you can not start a terminal :) – megas Jul 23 '18 at 18:26
  • @megas Indeed, I used iTerm2 (forgot to mention that!) :) – Joël Jul 25 '18 at 13:46
  • OP already said in the question that "other terminal app (iTerm2) is not running at all" – grg Aug 7 '18 at 18:26
  • In that case maybe trying github.com/zeit/hyper terminal could help – Joël Aug 16 '18 at 10:20

To be able to fix my terminal/iterm2/hyper (all were broke because of broken zsh) I had to first change my terminal settings 'Shells open with' from a custom command to the default login shell

enter image description here

The trick from @grg didn't work for me. With these changes, I was able to update my zsh via homebrew as suggested in the other answers and all three apps worked as expected again.

| improve this answer | |

After searching for a while, this solved it for me:

brew reinstall ncurses
| improve this answer | |
  • 1
    It's easy when you can start a terminal :) – megas Dec 13 '18 at 11:39
  • In terminal you can a command with Shift+Command+N hotkey. – SilentGuy Dec 2 '19 at 16:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .