DEV Community

Zell Liew 🤗
Zell Liew 🤗

Posted on • Originally published at zellwk.com

Installing MongoDB with Homebrew

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)"
Enter fullscreen mode Exit fullscreen mode

Second, find the MongoDB tap.

brew tap mongodb/brew
Enter fullscreen mode Exit fullscreen mode

Third, install MongoDB.

brew install mongodb-community
Enter fullscreen mode Exit fullscreen mode

MongoDB is now installed on your computer. To use MongoDB, you need to create the /data/db folder with this command:

sudo mkdir -p /data/db
Enter fullscreen mode Exit fullscreen mode

You also need to give permissions to use it:

sudo chown -R `id -un` /data/db
Enter fullscreen mode Exit fullscreen mode

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


Thanks for reading. This article was originally posted on my blog. Sign up for my newsletter if you want more articles to help you become a better frontend developer.

Top comments (0)