Mongodb on macOS


I've never used MongoDB, but I started a new Node.js course using this NoSQL DB and I'm going to write a few words about how to install it on macOS.

Easy peasy with Homebrew.

brew install mongo
brew services start mongo # or stop, restart,...

Now you can set up new users typing mongo in a Terminal. When you get the prompt, type:

use admin
db.createUser({ user: "mongo", pwd: "mongo", roles: [{ role: "root", db: "admin" }] })
# if you already have a database (for example, homstead), add a new user with:
use homestead
db.createUser({ user: "homestead", pwd: "secret", roles: [{ role: "dbOwner", db: "homestead" }] }) 

You have a great multiplatform GUI called MongoDB Compass to access your databases. It's free and you can download it at


We request your permission to obtain statistical data on its navigation on this website. If you continue to browse we consider to accept the use of cookies. OK | More Information