[英]zsh: command not found: mongo
I'm following the official instructions found here (on Mac OS Big Sur): https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/我遵循此处的官方说明(在 Mac OS Big Sur 上): https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/
When attempting to run mongo
, I receive:尝试运行
mongo
时,我收到:
zsh: command not found: mongo
I then check if MongoDB is running by running:然后我通过运行检查 MongoDB 是否正在运行:
brew services start mongodb-community@4.4
I then receive:然后我收到:
Service mongodb-community@4.4 already started, use brew services restart mongodb-community@4.4 to restart
Because of this, I know MongoDB is running.因此,我知道 MongoDB 正在运行。 What gives?
是什么赋予了? I followed the official instructions from MongoDB's website.
我按照 MongoDB 网站的官方说明进行操作。
For Apple M1 Processor :对于Apple M1 处理器:
If you install mongodb
through Homebrew
, follow the steps below:如果您通过
Homebrew
安装mongodb
,请按照以下步骤操作:
Open up your Terminal
打开你的
Terminal
Type brew list
to check the formulae of the installed mongodb
输入
brew list
查看已安装mongodb
的公式
==> Formulae
mongodb-community@4.4 mongodb-dxxx...
==> Casks
xxxxx
mongodb-community@4.4
.mongodb-community@4.4
。brew list mongodb-community@4.4
to get the directory of the mongodb
installed in your machine.brew list mongodb-community@4.4
以获取安装在您机器中的mongodb
的目录。/opt/homebrew/Cellar/mongodb-community@4.4/4.4.13/bin/install_compass
/opt/homebrew/Cellar/mongodb-community@4.4/4.4.13/bin/mongo
/opt/homebrew/Cellar/mongodb-community@4.4/4.4.13/bin/mongod
/opt/homebrew/Cellar/mongodb-community@4.4/4.4.13/bin/mongos
/opt/homebrew/Cellar/mongodb-community@4.4/4.4.13/homebrew.mxcl.mongodb-community@4.4.plist
/opt/homebrew/Cellar/mongodb-community@4.4/4.4.13/MPL-2
/opt/homebrew/Cellar/mongodb-community@4.4/4.4.13/THIRD-PARTY-NOTICES
Copy the bin path of your mongodb: /opt/homebrew/Cellar/mongodb-community@4.4/4.4.13/bin
复制 mongodb 的 bin 路径:
/opt/homebrew/Cellar/mongodb-community@4.4/4.4.13/bin
Open up your .zshrc
file with any text-editor使用任何文本编辑器打开您的
.zshrc
文件
Add this line to the file:将此行添加到文件中:
export PATH="/opt/homebrew/Cellar/mongodb-community@4.4/4.4.13/bin:${PATH}"
mongo --version
in your terminal, if you see similar output like shown below, you are good to go.mongo --version
,如果您看到如下所示的类似输出,那么您就可以开始了。MongoDB shell version v4.4.13
Build Info: {
"version": "4.4.13",
"gitVersion": "df25-----------b9246",
"modules": [],
"allocator": "system",
"environment": {
"distarch": "x86_64",
"target_arch": "x86_64"
}
}
echo 'export PATH="/usr/local/opt/mongodb-community@4.4/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
I solved my problem with this command running on terminal but only path i added is diffrent Steps-我用在终端上运行的这个命令解决了我的问题,但我添加的唯一路径是不同的步骤 -
and it's done完成了
Thanks谢谢
I did the above procedures and it still didn't work.我做了上面的步骤,还是不行。 But I restarted my terminal using $exec bash -l and it works!
但是我使用 $exec bash -l 重新启动了我的终端,它可以工作了!
I did the above procedures and it still didn't work.我做了上面的步骤,还是不行。 But use this, then it worked
但是使用它,然后它就起作用了
brew install mongodb-community-shell brew install mongodb-community-shell
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.