[英]Why doesn't psql --version work in zsh macOS?
从 postgresql.org/download 安装 Postgresql,然后运行 brew install postgresql 后,我试图通过在我的 zsh 终端上键入“psql --version”来确认我已经安装了 postgresql。 但是,它显示以下错误消息:
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
我尝试了很多在网上找到的命令,例如 brew doctor、brew update、brew install readline、brew link readline --force 和 cd /usr/local/opt/readline/lib ln -s libreadline.8.0.dylib libreadline.7 .dylib,不是特别有序。
为什么我安装成功后提示“Library is not loaded”,我可以运行什么命令来解决?
在运行 MacOS Mojave 时遇到同样的问题。 当我试图启动服务器时,我正在创建一个新的 Rails 6.1.3 应用程序,我收到了这个错误:
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
当我运行psql
时,出现了这个错误:
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
这是我为使其正常工作所做的工作。 我不是这方面的专家,我不能保证关闭系统完整性保护是个好主意,哈哈:你可以尝试重新安装 Postgres,而不先关闭 SIP,看看它是否有效:
我关闭了系统完整性保护。 我在终端中运行此命令以查看它是否已启用: csrutil status
此评论谈到了它: https://github.com/kelaberetiv/TagUI/issues/86#issuecomment-532462565我按照以下说明进行操作: https://www.imore.com/how-turn-system-integrity-protection-macos 。
然后我按照这些说明用 Brew 重新安装 Postgres: https://gist.github.com/ibraheem4/ce5ccd3e4d7a65589ce84f2a3b7c23a3
因为我已经安装了 Postgres,所以我只需要进入pg_start
步骤并运行psql
,它又可以工作了!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.