I just installed posgresql with homebrew and when I go on to type the command
psql
I get the following error:
dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.6.2.dylib
Referenced from: /usr/local/bin/psql
Reason: image not found
[1] 69711 trace trap psql
Does anyone have any idea about what's wrong?
In my case the correct answer did not fix the problem.
The problem started after running
brew doctor
and addingexport PATH="/usr/local/bin:$PATH"
to my ~/.zshrc file.Removing
from
~/.zshrc
got it solved.This worked for me
This would display the versions you have installed. Pick one out of them. I picked 7.0.5
I then ran
The readline version got updated, and
psql
ran smoothly.The answer above didn't work for me so I wanted to post what did eventually work. Based on a thread I found here, I had to uninstall readline and the install it again but from source.
After that the psql error went away.
The solution is to force the linking of readline again.
I was getting the exact same error, but the above answers didn't work for me. I had to reinstall postgresql.
brew reinstall postgresql
The key problem is that your postgresql was trying to find the
libreadline.6.2.dylib
but yourreadline
is version7.0
, so only 7's lib is linked.I don't think upgrading postgresql is a good idea, it's not easy and may cause a lot of problem, especially when you already have database data.
What I do, is to switch the version of
readline
. When you checkbrew info readline
, you will find different versions, mine is6.3.8
, so I switch to that version by executing:It will change to 6.3.8 and create the link:
In this case, all the linked lib becomes to 6 version, and command line works:
However, if you have different apps using different version of readline, I think you should consider upgrading.