I\'ve installed mongodb and have been able to run it, work with it, do simple DB read / write type stuff. Now I\'m trying to set up my Mac to run mongod as a service.
With recent builds of mongodb community edition, this is straightforward.
When you install via brew, it tells you what exactly to do. There is no need to create a new launch control file.
$ brew install mongodb
==> Downloading https://homebrew.bintray.com/bottles/mongodb-3.0.6.yosemite.bottle.tar.gz ### 100.0%
==> Pouring mongodb-3.0.6.yosemite.bottle.tar.gz
==> Caveats
To have launchd start mongodb at login:
ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents
Then to load mongodb now:
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
==> Summary
Just installed MongoDB via Homebrew. At the end of the installation console, you can see an output as follows:
To start mongodb:
brew services start mongodb
Or, if you don't want/need a background service you can just run:
mongod --config /usr/local/etc/mongod.conf
So, brew services start mongodb, managed to run MongoDB as a service for me.
After installing mongodb through brew, run this to get it up and running:
mongod --dbpath /usr/local/var/mongodb
install mongodb in your linux machine with
apt install mongodb-client && apt install mongodb-server
change the database path instead of your system default path if you want.
so do the following steps and change it for yourself.
mongod --directoryperdb --dbpath /var/lib/mongodb/data/db --logpath /var/lib/mongodb/log/mongodb.log --logappend --rest
and in your windows machine do it just like that just put an --install flag. you have to get a successful message.
Best Regards...
If you feel like having a simple gui to fix this (as I do), then I can recommend the mongodb pref-pane. Description: https://www.mongodb.com/blog/post/macosx-preferences-pane-for-mongodb
On github: https://github.com/remysaissy/mongodb-macosx-prefspane