[英]Mongo command not found on Mac using zsh?
我通过官方网站安装了 Mongo Db。 我还创建了以下文件夹
~/data/db
我在如下位置添加了 mongo 文件:
/usr/local/mongodb
我正在使用 zsh,因此按照 bash_profile 中的建议设置环境变量对我不起作用。 my.zshrc 文件如下所示
export PATH=$HOME/bin:/usr/local/bin:$PATH
export MONGO_PATH=/usr/local/mongodb
export PATH=MONGO_PATH/bin:$PATH
我还按如下方式运行了 source 命令:
source ~/.zshrc
然而,即使在尝试了各种答案的变体之后,我仍然得到:
zsh: command not found: mongo
我在这里错过了什么?
尝试brew install mongodb-community-shell
。
我的情况:
我确实尝试了brew services start mongodb
来解决它,但是遇到了这个问题:
Error: No available formula with the name "mongodb". Did you mean mongosh or monetdb?
这是关于如何解决它的建议,其中brew install mongodb-community-shell
作为最新 Mongo shell 的一部分安装提到: https://developpaper.com/fix-mac-brew-installation-mongodb-error-no-available -公式-with-the-name-mongodb/
这个对我有用。在新的 macbook 或 air 中我们找不到.zhrc
或bash
在新的 mac 中它的.zprofile
。 所以更改.zprofile
中的路径
export PATH=/opt/homebrew/bin:$PATH
brew install mongodb-community-shell
你可以尝试它对我有用,因为在下载 mongodb 时它缺少 shell 所以在终端中输入 mongo 时它不起作用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.