Last updated Aug 5, 2022

How to Install MongoDB on macOS (Step-by-Step)

Set up MongoDB on your Mac the easy way. Follow this developer-friendly guide to install, configure, and run MongoDB locally without hassle.

How to Install MongoDB on macOS (Step-by-Step)

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 https://brew.sh 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 /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.

💡Tip:

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

brew services start mongo

Tags

Available for projectsLet’s build together

Need this built properly,
not just explained?

I take on Angular and NestJS work directly — auth systems, multi-tenant SaaS, API rewrites and the deploy pipeline underneath them. You talk to the person writing the code.

Projects delivered
20+ Projects delivered
Angular • NestJS
7+ years Angular • NestJS
Average reply time
1 day Average reply time

What I can help with

  • Auth and permissions systems
  • Multi-tenant SaaS foundations
  • API design and rewrites
  • Deploy pipelines and VPS setup
  • Bug fixing and performance optimization
Send me a message

Tell me about your project and I’ll get back with a realistic scope and price.

Turn
Your Ideas
Into Reality

Stay in the loop

Get the finished tutorials, projects and resources in your inbox.

Join 5,000+ developers and get new tutorials, source code, product updates and exclusive content — straight to your inbox.

  • No spam
  • Useful content only
  • Unsubscribe anytime

Subscribe to TutsCoder

Be the first to get new tutorials, projects and tips.

Join 5,000+ developers already learning with us.

Learn
Build
Grow

Discussion

Comments

Share your thoughts, ask questions or suggest improvements. Let’s learn and grow together!

Loading comments…

Join the discussion

Sign in to join the discussion. Your account also keeps your saved tutorials and path progress.