xcode - 使用 homebrew 和 Xcode 8.1.1 安装 Mongodb 失败

标签 xcode mongodb macos installation

在运行 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?

最佳答案

我正在运行 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保持不动并监控交通是必要的。

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

关于xcode - 使用 homebrew 和 Xcode 8.1.1 安装 Mongodb 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48251108/

相关文章:

xcode - Swift 拖放在 Xcode 之外不起作用

ios - 1 为企业和 App Store 打造的应用程序

macos - 在沙盒应用中访问桌面

ios - 如何在计时器暂停时捕获耗时

ios - 核心数据: Setting an NSSet Swift

mongodb - Spring数据mongo分页

php - fatal error - 找不到 'Mongo' 类

mongodb - 选择字段不存在、为空或为假的 MongoDB 文档?

ruby-on-rails - 如何在 OS X Mountain Lion 上完全卸载 RailsInstaller

swift - 如何使用 swift 将变量数组分成更小的数组