# Install MongoDB Community Edition on macOS

# Overview

Use this tutorial to install MongoDB 4.2 Community Edition on macOS using the third-party brew package manager.

# MongoDB Version

This tutorial installs MongoDB 4.2 Community Edition. To install a different version of MongoDB Community, use the version drop-down menu in the upper-left corner of this page to select the documentation for that version.

# Install MongoDB Community Edition

brew tap mongodb/brew
brew install mongodb-community@4.2

In addition to the binaries (opens new window), the install creates:

# Run MongoDB Community Edition

ps aux | grep -v grep | grep mongod

You can also view the log file to see the current status of your mongod process: /usr/local/var/log/mongodb/mongo.log.

# Connect and Use MongoDB

To begin using MongoDB, connect a mongo (opens new window) shell to the running instance. From a new terminal, issue the following:

mongo

# Additional Information

# Troubleshooting ChecksumMismatchError

If you have previously installed an older version of the formula, you may encounter a ChecksumMismatchError resembling the following:

Error: An exception occurred within a child process:

  ChecksumMismatchError: SHA256 mismatch

Expected: c7214ee7bda3cf9566e8776a8978706d9827c1b09017e17b66a5a4e0c0731e1f

  Actual: 6aa2e0c348e8abeec7931dced1f85d4bb161ef209c6af317fe530ea11bbac8f0

 Archive: /Users/kay/Library/Caches/Homebrew/downloads/a6696157a9852f392ec6323b4bb697b86312f0c345d390111bd51bb1cbd7e219--mongodb-macos-x86_64-4.2.0.tgz

To retry an incomplete download, remove the file above.

To fix:

  1. Remove the downloaded .tgz archive.

  2. Retap the formula.

brew untap mongodb/brew && brew tap mongodb/brew
  1. Retry the install.
brew install mongodb-community@4.2