【问题标题】:Mongodb installation failed with homebrew and Xcode 8.1.1使用 homebrew 和 Xcode 8.1.1 安装 Mongodb 失败
【发布时间】:2023-03-24 23:52:01
【问题描述】:

在运行 brew install mongodb 时,我得到以下输出:

Updating Homebrew...
mongodb: A full installation of Xcode.app 8.3.2 is required to compile this software.
Installing just the Command Line Tools is not sufficient.
Xcode can be installed from the App Store.
Error: An unsatisfied requirement failed this build.

我的系统在 OSX El Capitan 版本 10.11.6 上运行。

有没有在不升级到 Mac OS Sierra 和 Xcode 8.3.3 的情况下安装 mongodb?

【问题讨论】:

  • 我遇到了同样的问题,如果得到解答,请告诉我。尝试运行 brew doctor 并修复所有问题,然后重试。

标签: xcode mongodb macos installation


【解决方案1】:

我运行的是 OSX 10.11.6,无法更新到 10.12,因为我的机器较旧(2009 年中的 Macbook Pro)。在尝试安装 MongoDB 时,我遇到了错误:

`mongodb: A full installation of Xcode.app 8.3.2 is required to compile 
this software.
Installing just the Command Line Tools is not sufficient.
Xcode can be installed from the App Store.
Error: An unsatisfied requirement failed this build.`

我目前有 XCode 8.0,无论如何,它需要一些其他类型的运行才能获得。所以我需要一个兼容的 MongoDB 构建。 3.0.6 是兼容的。 使用 Homebrew 通过命令行安装:

`user$ brew search mongodb`

并收到这个答案:

`==> Searching local taps...
 mongodb                 mongodb@3.0             mongodb@3.2             
 mongodb@3.4             percona-server-mongodb`

现在:

`$ brew install mongodb@3.0`

好的,接下来我有一个关于在我的根目录中创建这些下一个目录的注释,但我是在我当前的用户(在操作系统上具有管理访问权限)中完成的。这些命令需要精确并按以下顺序:

`$ sudo mkdir -p /data/db`

(出现提示时输入您的 OSX 用户密码)

`$ sudo chown -R $USER /data/db`

`$ sudo chmod go+w /data/db`

下一个来自另一个 S.O.答案:How to install earlier version of mongodb with homebrew?

`$ brew link --force mongodb@3.0`

在成功完成--force 命令后提供下一个命令:

`$ echo 'export PATH="/usr/local/opt/mongodb@3.0/bin:$PATH"' >> 
 ~/.bash_profile`

现在,您可以将 Mongo 作为守护程序运行:

`$ mongod`

它现在应该在端口 27017 上侦听,在另一个终端选项卡中,您可以运行 $ mongo 并使用此选项卡输入您的 Mongo 查询和命令。在另一个选项卡中运行它很重要;允许$ mongod 保持原样并监控流量是必要的。

已编辑:根据@user122121 评论更新brew versions <> 命令并更新格式。

【讨论】:

  • 感谢 andrewbfr,您让我免于更新操作系统。
  • 嗨 Andrew,在运行brew install homebrew/versions/mongodb3.0 时,我收到以下homebrew/versions was deprecated. This tap is now empty as all its formulae were migrated。如果我继续,在brew link --force mongodb@3.0,我再次收到此错误Error: No such keg: /usr/local/Cellar/mongodb@3.0
  • brew install mongodb@3.0 而不是 brew install homebrew/versions/mongodb30 为我工作。
  • 嘿@user122121。我也收到了弃用通知,但它并没有导致我在安装时挂断电话。用更新后的brew install <desired mongo version> 找到解决方法很好。
【解决方案2】:

有没有在不升级到 Mac OS Sierra 和 Xcode 8.3.3 的情况下安装 mongodb?

很遗憾,要安装 Xcode 8.3+,您需要使用 MacOS Sierra 10.12。看 Apple App Store 中的 Xcode 兼容性要求以获取更多信息。

另一种方法是通过MongoDB Download Center 下载MongoDB 社区版,然后按照Install MongoDB Community Edition on MacOS 的说明进行操作。

【讨论】:

  • 既然它明确指出 mongodb 将在 Xcode 8.3 的完整安装上运行,并且只能在 Sierra 上运行,我在通过 MongoDB 下载中心安装它时不会发现同样的障碍吗?有什么方法可以安装与我的系统兼容的旧版本的 mongodb?
  • 当您通过 HomeBrew 安装时,默认情况下您将获得预编译版本(称为瓶子,请参阅 mongodb bottle。为了在本地计算机上编译公式 HomeBrew 需要 XCode。如果您从下载中心下载,你会得到编译后的二进制版本。从MongoDB v3.0+开始的二进制版本应该支持macos 10.7+(Lion)。
【解决方案3】:

您可以从 github 下载 mongodb-app: https://github.com/gcollazo/mongodbapp

在 brew 安装失败后,我能够在我的机器上成功运行 mongodb4。

【讨论】:

    猜你喜欢
    • 2020-01-11
    • 2022-11-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-28
    • 1970-01-01
    相关资源
    最近更新 更多