How to install MongoDB on macOS

How to install MongoDB on macOS

In this tutorial, we will learn how to install MongoDB on macOS step by step.

so, let's get started,

If you are using Windows 10 or 11, click here.

Install MongoDB on macOS step by step

1. Install brew package manager for mac

Head over to Copy the installation command from the homepage and paste it to your terminal.


2. Install the latest version of the node

brew install node

once the installation is completed, you can verify it by using node --version command

3. Install mongo

brew install mongo 

4. Create a DB folder for MongoDB 

sudo mkdir -P /data/db

5. Give read/write permission to the DB folder

sudo chown -Rv <user>/data/db

you can check your username by typing whoami command in terminal.

6. Verify Installation

now open two terminal tabs and type mongod  and mongo on another tab, it will start your MongoDB database.

👍Great!!!our installation is completed and now our MongoDB is ready to use.


you can use below command to  start mongodb automatically when system starts

brew services start mongo

Subscribe to our Newsletter

Stay up to date! Get all the latest posts delivered straight to your inbox.

If You Appreciate What We Do Here On TutsCoder, You Should Consider:

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

Leave a Comment