在运行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版上.

是否有安装mongodb而不升级到Mac OS Sierra和Xcode 8.3.3的方法?

推荐答案

我正在运行OSX 10.11.6,无法更新到10.12,因为我的机器比较旧(2009年年中的Macbook Pro).在try 安装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是兼容的.

`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 <>个命令.

Mongodb相关问答推荐

如何在MongoDB中正确解析佛年?

在MogoDB中按时间间隔分组、统计文档和获取间隔时间

聚合管道可以用于更新数据库中的文档吗?

lexik_jwt_authentication下无法识别的选项api_platform

如何在 Spring-Data-MongoDB 中使用 $facet、$addFields 和 $function

映射数组导致 mongodb 聚合

MongoDB获取聚合查询的executionStats

mongodump 是否锁定数据库?

Flask and Mongo

Mongoose 和新架构:返回ReferenceError: Schema is not defined

在 GridFS、express、mongoDB、node.js 中存储来自 POST 请求的数据流

如何使用原子操作在一个文档中切换布尔字段?

将 JSON 与 MongoDB 一起使用?

带有排序功能的mongoose findOne

NoSQL:MongoDB 或 BigTable 并不总是 Available意味着什么

Django admin 和 MongoDB,可能吗?

Java + MongoDB:更新文档中的多个字段

在 MongoDB 中为现有用户更改密码

通过 Java 执行 Mongo like Query (JSON)

如何在 Windows 上停止 mongodb 服务器?