If you've installed mongodb
community edition via Homebrew
on your mac, and it shows that error in the title, you can fix performing the following steps.
Note*: mongo
is deprecated and mongosh
is the new way to use mongodb shell. See in official docs.
Open your
Terminal
Type
brew list
to check the installedmongodb.
Find along the linemongodb-community.
Your case maybemongodb-community@6.0
Type again
brew list mongodb-community
to get the directory installed on your machine.Copy the bin path of
mongodb
until the 'bin'for my case -
/opt/homebrew/Cellar/mongodb-community/6.0.1/bin
Open .zshrc with nano or other text editor:
nano .zshrc
Add this in the file (combining with ${PATH} in the above path):
export PATH="/opt/homebrew/Cellar/mongodb-community/6.0.1/bin:${PATH}"
Save and exit.
Run
mongosh
and it should work now. ✨