使用 Homebrew 安装 MongoDB

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/57856809/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 21:01:27  来源:igfitidea点击:

Installing MongoDB with Homebrew

mongodbmacoshomebrew

提问by Paul Vu

I'm relatively new to MongoDB and am trying to install MongoDB on my Mac with Homebrew, but I'm getting the following error:

我对 MongoDB 比较陌生,正在尝试使用 Homebrew 在我的 Mac 上安装 MongoDB,但出现以下错误:

Error: No available formula with the name "mongodb" 
==> Searching for a previously deleted formula (in the last 
month)...
Warning: homebrew/core is shallow clone. To get complete history 
run:
  git -C "$(brew --repo homebrew/core)" fetch --unshallow

Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.

I ran brew updateThen brew install mongodb

我跑了 brew update然后 brew install mongodb

回答by Simba

Formula mongodbhas been removed from homebrew-core. Check pr-43770from homebrew-core

公式mongodb已从 homebrew-core 中删除。从 homebrew-core检查pr-43770

To our users: if you came here because mongodb stopped working for you, we have removed it from the Homebrew core formulas since it was migrated to a non open-source license.

致我们的用户:如果您来到这里是因为 mongodb 停止为您工作,我们已将其从 Homebrew 核心公式中删除,因为它已迁移到非开源许可证

Fortunately, the team of mongodb is maintaining a custom Homebrew tap. You can uninstall the old mongodb and reinstall the new one from the new tap.

幸运的是,mongodb 的团队正在维护一个自定义的 Homebrew Tap。您可以卸载旧的mongodb,然后从新的tap 重新安装新的mongodb。

brew services stop mongodb
brew uninstall mongodb

brew tap mongodb/brew
brew install mongodb-community
brew services start mongodb-community

Check mongodb/homebrew-brewfor more info.

检查mongodb/homebrew-brew以获取更多信息。

回答by Sajeer Kunnoth

first install mongoldb

首先安装mongoldb

brew tap mongodb/brew

Secondly install using this command. mangodb successfully installed

其次使用此命令安装。mangodb 安装成功

brew install [email protected] 

You will get the output

你会得到输出

==> CaveatsTo have launchd start mongodb/brew/mongodb-community now and restart at login: brew services start mongodb/brew/mongodb-community Or, if you don't want/need a background service you can just run: mongod --config /usr/local/etc/mongod.conf ==> Summary /usr/local/Cellar/mongodb-community/4.2.2: 21 files, 274.5MB, built in 2 minutes 46 seconds brew services start mongodb/brew/mongodb-community ==> Successfully started mongodb-community(label: homebrew.mxcl.mongodb-commu

==> 注意事项现在启动 mongodb/brew/mongodb-community 并在登录时重新启动: brew services start mongodb/brew/mongodb-community 或者,如果您不想要/不需要后台服务,您可以运行:mongod - -config /usr/local/etc/mongod.conf ==> 总结 /usr/local/Cellar/mongodb-community/4.2.2: 21 个文件,274.5MB,2 分 46 秒内建 brew services start mongodb/brew/ mongodb-community ==> 成功启动mongodb-community(标签:homebrew.mxcl.mongodb-commu

回答by reza_khalafi

Try this code in your terminal:

在您的终端中尝试此代码:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 

And then:

进而:

brew tap mongodb/brew  

Finally:

最后:

brew install [email protected]