Não há nenhum comando de serviço no OS X. Ele provavelmente está sendo gerenciado pelo launchd, o que significa que você precisará fazer o seguinte ( encontrado no Stack Overflow ). Note que existem 2 respostas abaixo, uma se você instalou usando a opção de casa, a outra não.
It's probably because launchctl is managing your mongod instance. If you want to start and shutdown mongod instance, unload that first:
launchctl unload -w ~/Library/LaunchAgents/org.mongodb.mongod.plistThen start mongod manually:
mongod -f path/to/mongod.conf --forkYou can find your mongod.conf location from
~/Library/LaunchAgents/org.mongodb.mongod.plist.After that,
db.shutdownServer()would work just fine.Added Feb 22 2014:
If you have mongodb installed via homebrew, homebrew actually has a handy
brew servicescommand. To show current running services:
brew services listTo start mongodb:
brew services start mongodbTo stop mongodb if it's already running:
brew services stop mongodb