简体   繁体   中英

Why doesn't psql --version work in zsh macOS?

After installing Postgresql from postgresql.org/download, and then running brew install postgresql, I am trying to confirm I have installed postgresql by typing 'psql --version' on my zsh, terminal. However, it is showing the following error message:

     psql --version
      dyld: Library not loaded: /usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib
  Referenced from: /usr/local/Cellar/postgresql/12.4/lib/libpq.5.12.dylib
  Reason: image not found
zsh: abort      psql --version

I have tried many commands I found online such as brew doctor, brew update, brew install readline, brew link readline --force, and cd /usr/local/opt/readline/lib ln -s libreadline.8.0.dylib libreadline.7.dylib, not particularly in order.

Why is the error message saying "Library is not loaded" when I have successfully installed, and what commands can I run to resolve?

Had the same problem here running MacOS Mojave. I was creating a new Rails 6.1.3 app when I tried to start the server, I got this error:

dlopen(/Users/my_user_name/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pg-1.2.3/lib/pg_ext.bundle, 9): Library not loaded: /usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib (LoadError) Referenced from: /usr/local/opt/postgresql/lib/libpq.5.dylib Reason: image not found - /Users/my_user_name/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pg-1.2.3/lib/pg_ext.bundle

and when I ran psql , I got this error:

dyld: Library not loaded: /usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib Referenced from: /usr/local/lib/libpq.5.dylib Reason: image not found Abort trap: 6

Here's what I did to get it to work. I'm no expert on this stuff and I can't guarantee that it's a good idea to turn off System Integrity Protection, haha: You could try to reinstall Postgres without turning SIP off first and see if it works:

Since I already had Postgres installed, I just got to the pg_start step and ran psql and it was working again!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM