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?

up vote 19 down vote accepted
  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.

  • 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 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 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 :-)

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

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

New contributor
coderuby is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.