aweber-banner
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,

 Install MongoDB on macOS step by step

1. Install brew package manager for mac

Head over to https://brew.sh Copy the installation command from the homepage and paste it to your terminal.

Install-Brew
Install-Brew

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 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 mongod is ready to use.

Tip:

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