Popular Question on How To Install MongoDB on Mac
by Alexandra Kropova from Mammoth Interactive
Are you getting an error message saying ‘ sudo mongod ‘ command not found when trying to use MongoDB and the Mongo shell on Mac? Here’s your solution!
Want to learn more? Enroll in Complete Web & App Development with Machine Learning For All (125 Hours). Free in the Mammoth Unlimited Membership. Get 250+ courses and 2,000 hours at a dirt-cheap price.
Solution
Sometimes the alias for mongod doesn’t work. Use the full path to mongod instead:
sudo mongod --dbpath /System/Volumes/Data/data/db
Still not working?
Another option is a direct download of a ZIP file of MongoDB from Mongo’s official website.
Check that you installed MongoDB correctly.
Toolkit:
- MacOS
- MongoDB 5.0
- Homebrew
- npm 7.21.0
- Node v14.17.5
Suggest more solutions or ask a question in the comments below.
Want to learn more? Enroll in Complete Web & App Development with Machine Learning For All (125 Hours). Free in the Mammoth Unlimited Membership. Get 250+ courses and 2,000 hours at a dirt-cheap price.