Why doesn't Mongo read the /usr/local/mongodb/mongod.conf file?

If you install MongoDB using brew, the LaunchAgent files that it generates for you will use a configuration file at /usr/local/etc/mongod.conf by default.

This behavior is defined in:

https://github.com/Homebrew/homebrew/blob/master/Library/Formula/mongodb.rb

Note that this "default" only applies when running MongoDB as a service via launchctl, not manually starting it by running mongodb.

As of 2015-03-09, the instructions given by Homebrew after installing MongoDB 3.0.0 are:

==> Caveats
To reload mongodb after an upgrade:
    launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
Or, if you don't want/need launchctl, you can just run:
    mongod --config /usr/local/etc/mongod.conf

Note the explicit --config argument in the manual run command.


You must specify if you want it to use another config; there isn't a default config file.

See Here: File Based Configuration

To achieve what you want to do; you can either specify your config path or start your mongo server like:

mongod --dbpath /usr/local/mongodb_data

Tags:

Macos

Mongodb