在Mac上通过Homebrew安装PostgreSQL时出错

时间:2018-08-01 11:22:26

标签: postgresql macos homebrew

在Mac(OSX 10.11.6)上通过Homebrew安装PostgreSQL时,出现以下错误:

Error: The `brew link` step did not complete successfully The formula
  built, but is not symlinked into /usr/local

initdb: file "/usr/local/share/postgresql/postgres.bki" does not exist
  This might mean you have a corrupted installation or identified the 
  wrong directory with the invocation option -L.

/postgresql文件夹不存在。

不确定是否相关,但我已经通过Homebrew安装了OpenSSL 1.0.2o_2和Readline 7.0.5。

有人知道为什么会发生此错误以及如何解决吗?

2 个答案:

答案 0 :(得分:3)

对于我来说,我安装了libpq,它阻止了postgresql的链接。取消链接libpq之后再链接PostgreSQL可以解决此问题。

brew unlink libpq
brew link postgresql
brew postinstall postgresql

答案 1 :(得分:0)

设法解决问题。这是一个权限问题。原始答案可以在这里找到:Homebrew: Could not symlink, /usr/local/bin is not writable

简而言之,执行以下命令:

sudo chown -R `whoami`:admin /usr/local/bin
sudo chown -R `whoami`:admin /usr/local/share
sudo chown -R `whoami`:admin /usr/local/opt
相关问题