Skip to content

Instantly share code, notes, and snippets.

@nrollr
Last active April 25, 2026 05:25
Show Gist options
  • Select an option

  • Save nrollr/9f523ae17ecdbb50311980503409aeb3 to your computer and use it in GitHub Desktop.

Select an option

Save nrollr/9f523ae17ecdbb50311980503409aeb3 to your computer and use it in GitHub Desktop.
Install MongoDB on Sierra using Homebrew

Install MongoDB on macOS Sierra

This procedure explains how to install MongoDB using Homebrew on macOS Sierra 10.12.
Official MongoDB install documentation: here

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.

Install MongoDB

At this time of writing, Homebrew has MongoDB version 3.2.10 as default formulae in its main repository :

  • Enter the following command : $ brew info mongodb
  • Expected output: mongodb: stable 3.2.10 (bottled)

To install MongoDB enter : $ brew install mongodb

Additional configuration

Homebrew

To load and start the MongoDB background service, open Terminal and execute the following commands :

  • Install brew services first : $ brew tap homebrew/services

  • Load and start the MongoDB service : $ brew services start mongodb.
    Expected output : Successfully started mongodb (label: homebrew.mxcl.mongodb)

  • Check of the MongoDB service has been loaded : $ brew services list 1

  • Verify the installed MongoDB instance : $ mongod --version.
    Expected output : db version v3.2.10

Comments

1 The brew services start mongodb - instruction is equal to :

ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
@MatthewWyn

Copy link
Copy Markdown

Thank you for this.
Does it normally take like 10 minutes for Homebrew to download/install?
I have a good spec Mac Air and excellent internet connection.

@tjfwalker

Copy link
Copy Markdown

@MatthewWyn, no, i don't think so. I've an older MacBook Pro w/ decent internet connection and the download took less than a minute.

@DinocomM

Copy link
Copy Markdown

it works also perfectly on a mac os high sierra.

After this you can manage the mongodb with robomongo for mac, just download it from here

Thank you!!

@playground

Copy link
Copy Markdown

How to tell "brew services start mongodb" to use /data/db?

@mitridate

Copy link
Copy Markdown

dyld: Symbol not found: _syslog$DARWIN_EXTSN
Referenced from: /usr/local/bin/mongod
Expected in: /usr/lib/libSystem.B.dylib
in /usr/local/bin/mongod
Abort trap: 6

@dmp1007

dmp1007 commented Feb 16, 2018

Copy link
Copy Markdown

Thank you!

@mallowigi

Copy link
Copy Markdown

Why the fuck isn't this on the official documentation!?

@pgbezerra

Copy link
Copy Markdown

You can open a MR, @mallowigi and will be in official documentation.

@chhaymenghong

Copy link
Copy Markdown

is there a way to specify a path to mongod.conf when running mongod using brew command?
Sth like: brew services start mongodb -f path/to/mongod.conf

@hugazo

hugazo commented May 11, 2018

Copy link
Copy Markdown

life saver, thanks.

@wdlv

wdlv commented May 21, 2018

Copy link
Copy Markdown

Couldn't find the path to mongod.conf since it is not under /etc/.

@wdlv

wdlv commented May 21, 2018

Copy link
Copy Markdown

FYI: I find that mongod.conf is under /usr/local/etc/

@vixduong

Copy link
Copy Markdown

Thanks 👍

@juliecious

Copy link
Copy Markdown

Thank you!

@vidukapoor

vidukapoor commented Sep 24, 2018

Copy link
Copy Markdown

thanks, thats a easy one. :)

@nadtakanfuthoem

Copy link
Copy Markdown

thank you

@dong-dev

Copy link
Copy Markdown

is there a way to specify a path to mongod.conf when running mongod using brew command?
Sth like: brew services start mongodb -f path/to/mongod.conf

Default service run by /usr/local/opt/mongodb/homebrew.mxcl.mongodb.plist
so you can see default mongo conf file at /usr/local/etc/mongod.conf, replace with your own
then run brew services start mongodb
or brew services start mongodb if mongodb service started

@mapinetree311

Copy link
Copy Markdown

Thanks

@haochenpan

Copy link
Copy Markdown

sudo chmod 777 /data/db

Thank you!

@matthewmjm

Copy link
Copy Markdown

after about 2 hours of trying all sorts of things, I finally got it to work thanks to you. THANK YOU!!

@jetobe95

jetobe95 commented Feb 28, 2019

Copy link
Copy Markdown

Thankssss for tutoriall!!!

@stus3y

stus3y commented Apr 2, 2019

Copy link
Copy Markdown

Thanks a lot!

@Bestchoice233

Copy link
Copy Markdown

Thanks so much!!!

@ianhernandez

Copy link
Copy Markdown

✌️

@calvinbcoding

Copy link
Copy Markdown

thank you sir,
THANK YOU

@kheengz

kheengz commented Feb 6, 2020

Copy link
Copy Markdown

for MacOS Catalina

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment