How to start a mongodb service on mac OS X?
Try the following steps in Terminal:
which mongod
This will output the path to your mongod
, but if it is not in your $PATH
the command output will be empty. So you need to find your executable:
find / -name 'mongod'
In the output of this command, you will see many lines, one of which will be like bin/mongod
, e.g. /usr/local/mongodb/bin/mongod
. In that case take the whole absolute path and do the following:
echo "PATH=/usr/local/mongodb/bin/:$PATH" >> ~/.bash_profile. ~/.bash_profile
Then try again:
mongod --dbpath /your/path
Just do brew services start mongodb-community
. Example:
$ brew services listName Status User Plistmongodb-community stopped $ brew services start mongodb-community==> Successfully started `mongodb-community` (label: homebrew.mxcl.mongodb-community)
Of course, depends on your installation. This is the typical brew install.