dyld:惰性符号绑定失败:找不到符号:_PQsetErrorContextVisibility

dyld: lazy symbol binding failed: Symbol not found: _PQsetErrorContextVisibility

在 运行

$ psql

我收到这个错误

dyld: lazy symbol binding failed: Symbol not found: 
_PQsetErrorContextVisibility
Referenced from: /usr/local/bin/psql
Expected in: /usr/local/lib/libpq.5.dylib

dyld: Symbol not found: _PQsetErrorContextVisibility
Referenced from: /usr/local/bin/psql
Expected in: /usr/local/lib/libpq.5.dylib

Abort trap: 6

我尝试了一些方法:

  1. 很少有帖子建议更新 brew
  2. 很少有人建议将 /usr/local/bin/psql 添加到 ~/.bash_profile 并重新启动系统
  3. 很少有人说这是 XCode 的问题,但我没有安装 XCode,所以我猜它对我来说无效。

但 none 有效。

我的bash_profile看起来像这样

PATH="/usr/local/bin/psql:/usr/local/sbin:/usr/local/bin:/sbin:/bin
:/usr/sbin:/usr/bin:/root/bin:/usr/local/bin/geckodrive‌​r:$PATH"
export PATH

我正在使用:

我也在使用 PostgreSQL 9.6.2, 和 运行 陷入同样的​​问题。

我像这样使用 brew 升级到 9.6.3:

rm '/usr/local/lib/libpq.5.dylib'
brew upgrade postgresql
brew link postgresql

成功了,现在我又可以通过 psql 访问了。

对我有用的是使用以下代码卸载并重新安装 postgres:

brew uninstall postgresql
brew install postgresql