M1芯片是否支持安装Mongo CLI?

Does the M1 chip support the installation of the Mongo CLI?

我在将 MongoDB CLI 安装到我的 Apple Mac Mini M1 上时遇到困难。我已成功安装 Homebrew 和 MongoDB Community 4.4,但在为 MongoDB.

安装 CLI 时遇到问题

我查看了这里的 ,并决定从使用 Rosetta 的新终端尝试 brew install mongocli,但我收到了相同的错误消息:

> ****@********-Mac-mini ~ % brew install mongocli Error: formulae
> require at least a URL
> /opt/homebrew/Library/Homebrew/formula.rb:253:in
> `determine_active_spec'
> /opt/homebrew/Library/Homebrew/formula.rb:206:in `initialize'
> /opt/homebrew/Library/Homebrew/formulary.rb:153:in `new'
> /opt/homebrew/Library/Homebrew/formulary.rb:153:in `get_formula'
> /opt/homebrew/Library/Homebrew/formulary.rb:366:in `factory'
> /opt/homebrew/Library/Homebrew/cli/parser.rb:648:in `block in
> formulae' /opt/homebrew/Library/Homebrew/cli/parser.rb:644:in `map'
> /opt/homebrew/Library/Homebrew/cli/parser.rb:644:in `formulae'
> /opt/homebrew/Library/Homebrew/cli/parser.rb:301:in `parse'
> /opt/homebrew/Library/Homebrew/cmd/install.rb:132:in `install'
> /opt/homebrew/Library/Homebrew/brew.rb:122:in `<main>'

您对如何解决这个问题有什么建议吗?

mongocli 尚不可用于 M1 (arm64)

要安装 mongocli,您可以安装 brew for intel (x86_64) 以及 brew for m1

将bash切换为x86_64

arch -x86_64 bash

安装 brew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

它将在

下为 x86_64 安装 brew
/usr/local/homebrew/bin/brew 

您可以为 brew 创建别名以便于访问

alias brew_intel="arch -x86_64 /usr/local/homebrew/bin/brew"

安装mongocli

brew_intel tap mongodb/brew  
brew_intel install mongocli                                                               

创建别名或将 mongocli 添加到路径

alias mongocli="/usr/local/homebrew/Cellar/mongocli/1.13.0/bin/mongocli"

现在你可以运行 mongocli

mongocli --help