My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

Installing MongoDB with Homebrew

Zell Liew's photo
Zell Liew
·Dec 5, 2019

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. 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.


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.