Got Library not loaded: libreadline error when running psql, so I ran brew upgrade postgresql
This is a story about how I tried to use PostgreSQL after a long time, ran the psql command, got a Library not loaded: libreadline error, and resolved it by running brew upgrade postgresql.
$ psql
dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.6.2.dylib
Referenced from: /usr/local/bin/psql
Reason: image not found
[1] 61053 trace trap psql
brew update
brew upgrade postgresql
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
mv /usr/local/var/postgres /usr/local/var/postgres9.3.1
initdb /usr/local/var/postgres
pg_upgrade \\
-b /usr/local/Cellar/postgresql/9.3.1/bin \\
-B /usr/local/Cellar/postgresql/9.6.1/bin \\
-d /usr/local/var/postgres9.3.1 \\
-D /usr/local/var/postgres
cp /usr/local/Cellar/postgresql/9.6.1/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
When you occasionally want to use PostgreSQL, you don’t want to get stuck on version updates.
That’s all from the Gemba.