How to Install MongoDB 6.0 on MacOS

Posted by Chaitanya Shahare on Mon, Jan 2, 2023

These instructions are for MongoDB 6.0 Community Edition

Prerequisites

HomeBrew

Installing MongoDB 6.0 Community Edition

  1. Tap the MongoDB Homebrew Tap to download the official Homebrew formula for MongoDB and the Database Tools, by running the following command in your macOS Terminal:

    brew tap mongodb/brew
    
  2. To update Homebrew and all existing formulae:

    brew update
    
  3. To install MongoDB, run the following command:

    brew install mongodb-community@6.0
    

Installation is done.

Running MongoDB

Start

To start MongoDB,

brew services start mongodb-community@6.0

Stop

To stop MongoDB,

brew services stop mongodb-community@6.0

Verify

To verify if MongoDB is running, use the following command:

brew services list

Mongosh

To begin using MongoDB, connect mongosh to the running instance. From a new terminal, issue the following:

mongosh

Resources

MongoDB is installed and running.