Skip to content

Instantly share code, notes, and snippets.

@jamiely
Created June 20, 2018 18:00
Show Gist options
  • Save jamiely/b5348246b749b4552429c068fffadefb to your computer and use it in GitHub Desktop.
Save jamiely/b5348246b749b4552429c068fffadefb to your computer and use it in GitHub Desktop.
zsh immediately closing terminal window

I was suddenly having a problem after reinstalling python2 with brew

brew install python@2

Suddenly when opening new terminal windows, the window would close immediately (I wasn't able to see an error message).

Changing the default shell from zsh to /bin/bash seemed to fix the problem. I thought there might be a problem with the startup script, so I renamed it.

mv .zshrc{,_20180620}

This didn't seem to help; in fact, the problem seemed to only to happen when zsh was the default shell-- not when executing it from an existing shell.

I opened up Console.app and saw this message:

Removing excessive log: file://Users/me/Library/Logs/DiagnosticReports/zsh_2018-06-20_Computer.crash

Checking out the report, I saw this error:

Termination Reason:    DYLD, [0x1] Library missing

Application Specific Information:
dyld: launch, loading dependent libraries

Dyld Error Message:
  Library not loaded: /usr/local/opt/gdbm/lib/libgdbm.5.dylib
  Referenced from: /usr/local/bin/zsh
  Reason: image not found

So I tried to relink gdbm thinking it somehow got messed up

brew unlink gdbm && brew link gdbm

That didn't fix things. I looked at the directory where it was looking for the library /usr/local/opt/gdbm/lib/ and saw:

drwxr-xr-x  5 me admin   170 Jun 16 11:47 ./
drwxr-xr-x 13 me admin   442 Jun 20 09:28 ../
-r--r--r--  1 me admin 45308 Jun 20 09:27 libgdbm.6.dylib
-r--r--r--  1 me admin 73448 Jun 16 11:47 libgdbm.a
lrwxr-xr-x  1 me admin    15 Jun 16 11:47 libgdbm.dylib -> libgdbm.6.dylib

So it seems like gdbm got upgraded. I tried upgrading zsh

brew upgrade zsh

That fixed things!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment