Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
82 lines (53 sloc) 1.94 KB
layout title description slug tags
post
Installing MongoDB with Homebrew (Catalina and non-Catalina)
Updated steps to install MongoDB on a Mac.
install-mongodb
mongodb

I had to reconfigure my Macbook after sending it for repairs. During the reconfiguration period, I noticed the instructions I linked to in "Setting up a local MongoDB connection" were outdated.

Here's an updated version on how to install MongoDB on a Mac.

There are a few steps:

First, you install Homebrew. If you're curious about what Homebrew is, read this article.

# Installs Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Second, find the MongoDB tap.

brew tap mongodb/brew

Third, install MongoDB.

brew install mongodb-community

MongoDB is now installed on your computer.

Using MongoDB

If you want to use MongoDB, you need to create a /data/db folder on your computer.

Before MacOS Catalina

To use MongoDB, you need to create the /data/db folder with this command:

sudo mkdir -p /data/db

You also need to give permissions to use it:

sudo chown -R `id -un` /data/db

Now you can follow the rest of the article to set up your MongoDB connection.

Update for MacOS Catalina

Apple created a new Volume in Catalina for security purposes. If you're on Catalina, you need to create the /data/db folder in System/Volumes/Data.

Use this command:

sudo mkdir -p /System/Volumes/Data/data/db

Then, use this command to give permissions:

sudo chown -R `id -un` /System/Volumes/Data/data/db

Once you do this you should be able to run mongod as usual.

You can’t perform that action at this time.