I installed Mongo Db via the official site. I also created the below folder
~/data/db
I added the mongo files in the location as follows:
/usr/local/mongodb
Im using zsh so setting the environment variables as suggested in the bash_profile doesnt work for me. My.zshrc file looks as follows
export PATH=$HOME/bin:/usr/local/bin:$PATH
export MONGO_PATH=/usr/local/mongodb
export PATH=MONGO_PATH/bin:$PATH
I also ran the source command as follows:
source ~/.zshrc
However even after trying variations of various answers, I still get:
zsh: command not found: mongo
What am I missing here?
I have the same problem when I try to install Mongo with official doc
This instruction help me to run MongoDB on MacOS Mojave 10.14.6
mongod --version
brew install mongodb
mongod --version
brew services start mongodb
to run MongoDB on startup Try brew install mongodb-community-shell
.
My case:
I did try brew services start mongodb
to solve it, but face this issue:
Error: No available formula with the name "mongodb". Did you mean mongosh or monetdb?
Here is a recommendation on how to solve it where brew install mongodb-community-shell
mentioed as part install of the latest Mongo shell: https://developpaper.com/fix-mac-brew-installation-mongodb-error-no-available-formula-with-the-name-mongodb/
this one worked for me.in new macbook or air we cant find .zhrc
or bash
in new mac its .zprofile
. so change the path in .zprofile
export PATH=/opt/homebrew/bin:$PATH
brew install mongodb-community-shell
you can try it it work for me because when downloading mongodb it lacks the shell so when typing mongo in terminal it won't work
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.