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

时间:2021-03-02 05:46:53

标签: mongodb command-line-interface apple-m1

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

我查看了此处的 thread,并决定从使用 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>'

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

1 个答案:

答案 0 :(得分:1)

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