For Apple M1 Processor:
If you install mongodb
through Homebrew
, follow the steps below:
Open up your Terminal
Type brew list
to check the formulae of the installed mongodb
==> Formulae
mongodb-community@4.4 mongodb-dxxx...
==> Casks
xxxxx
- In my case, it is
mongodb-community@4.4
.
- In the terminal, type
brew list mongodb-community@4.4
to get the directory of the mongodb
installed in your machine.
/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
Open up your .zshrc
file with any text-editor
Add this line to the file:
export PATH="/opt/homebrew/Cellar/mongodb-community@4.4/4.4.13/bin:${PATH}"
- Try
mongo --version
in your terminal, if you see similar output like shown below, you are good to go.
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"
}
}