【问题标题】:Error installing PostgreSQL via Homebrew on Mac在 Mac 上通过 Homebrew 安装 PostgreSQL 时出错
【发布时间】:2019-01-08 22:49:51
【问题描述】:

在 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。

有谁知道为什么会出现这个错误以及我该如何解决?

【问题讨论】:

  • 在使用 Homebrew 安装 Postgres 时也遇到了一些问题。找到postgresapp.com 用于在 OSX 上管理不同的 PostgreSQL 版本
  • 感谢您的提示,正在努力寻找解决方案。可能会尝试这样做!
  • 你看过brew doctor的输出了吗?也许它可以给你一个线索。另外,您能否展示一下您是如何通过 Homebrew 安装 PostgreSQL 的?
  • 目录/usr/local/share/postgresql 应该包含成功安装后 Homebrew 安装的相关文件的所有符号链接。所以,我想,问题是为什么在你的情况下没有创建这个目录和符号链接。我刚刚在我的机器上做了brew reinstall postgresql,它工作正常。您是否手动更改了/usr/local/share 的权限?
  • 感谢另一个节点。你是对的,这是一个权限问题。递归 sudo chowning /user/local/share 文件夹就可以了。

标签: postgresql macos homebrew


【解决方案1】:

就我而言,我安装了 libpq,它阻止了 postgresql 链接。取消链接 libpq 然后链接 postgresql 为我解决了这个问题。

brew unlink libpq
brew link postgresql
brew postinstall postgresql

【讨论】:

    【解决方案2】:

    设法解决了问题。这是权限问题。原始答案可以在这里找到: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
    

    【讨论】:

    • 这对我不起作用。仍然出现同样的错误。
    猜你喜欢
    • 2023-04-04
    • 1970-01-01
    • 1970-01-01
    • 2021-07-30
    • 2018-12-07
    • 2020-05-31
    • 2023-03-08
    • 2015-08-05
    • 2019-03-01
    相关资源
    最近更新 更多