I ran "brew upgrade" from the terminal, before upgrading finished the battery ran out on my MBP and the computer restarted. Now when I go to open a terminal the terminal window flashes up for a split second before closing. I managed to capture the terminal output before it closed:

enter image description here

dyld: Library not loaded: /use/local/lib/libgdbm.4.dylib

How can I fix this?

Please note that I cannot open a terminal to issue any commands!

  • How did you set your shell to zsh ? The obvious way is restore the dylib from a backup
    – mmmmmm
    Jan 30, 2014 at 11:22
  • With chsh command. Any idea how I can open a bash shell?
    – StuR
    Jan 30, 2014 at 11:27
  • How did you recover from the brew upgrade? Jun 19, 2018 at 11:07
  • @PetrusTheron opened a bash shell and ran brew upgrade fixed it.
    – StuR
    Jun 21, 2018 at 22:26

1 Answer 1


Install iTerm.app You can set up a profile that you can set the start up program do be /bin/bash

Or create a new admin user and use that to restore or reinstall files. I think you might be able to use dscl from that user to change the original users' shell

  • 10
    I'm accepting this answer because the advice given would work. What I did though was right click terminal "New Command"... "bash", and was able to open a bash shell to fix this.
    – StuR
    Jan 30, 2014 at 11:35
  • 1
    Awesome @stur - feel free to edit or make your own answer. Any time you can solve things without needing additional software, the better. Also, once bash was running, did brew update suffice to correct whatever caused zsh to fail to complete the launch process.
    – bmike
    Jan 30, 2014 at 11:55
  • 1
    @bmike - yes brew upgrade fixed the missing dylib file, and I was able to restart the terminal into a zsh shell afterward. Thanks for your help.
    – StuR
    Jan 30, 2014 at 13:16
  • 1
    StuR, I have similar problem, i cannot run terminal or iterm because it fails to open bash. i could try another shell. However when I right-click terminal, i do not see a "New Command" option. ??? Oct 20, 2016 at 23:07
  • 1
    I managed to execute the command /usr/local/bin/brew update, from Automator execute shell script and using /bin/csh shell. let's see if it works. Oct 20, 2016 at 23:14

You must log in to answer this question.

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