I installed MongoDB using homebrew recently. A few articles on the web advise to start mongo using the following command,

brew services start mongo

But when I use this command, I get the following message,

Error: Unknown command: services

I tried searching about this problem online. But no luck so far. What could be the problem here? I installed homebrew as it was specified on their website. Why is this feature not working for me?

And the man page has no information regarding the 'services' command.


services was a "hidden" command in Homebrew. There were a bunch of them that weren't present in the brew help output. It has, as undocumented commands are wont to do, gone away in the official repository and has become an "external command" maintained in another add-on repository (in this case a gist as it is so simple).

You can install it in your Homebrew setup by running:

> curl -o /usr/local/bin/brew-services.rb https://gist.githubusercontent.com/lwe/766293/raw/75a7907004bbff0eb3b072d1d951be2cfe7e5020/brew-services.rb
> chmod +x /usr/local/bin/brew-services.rb
> brew services help
usage: [sudo] brew services [--help] <command> [<formula>]

Small wrapper around `launchctl` for supported formulas, commands available:
   cleanup Get rid of stale services and unused plists
   list    List all services managed by `brew services`
   restart Gracefully restart selected service
   start   Start selected service
   stop    Stop selected service

Options, sudo and paths:

  sudo   When run as root, operates on /Library/LaunchDaemons (run at boot!)
  Run at boot:  /Library/LaunchDaemons
  Run at login: /Users/ian/Library/LaunchAgents

Alternatively you can skip services and just make a plist file for it. For example, create ~/Library/LaunchAgents/org.mongodb.mongod.plist with:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">

Just change {your_username} to your actual username then run:

launchctl load ~/Library/LaunchAgents/org.mongodb.mongod.plist 

to register the plist with launchd. You can now start and stop MongoDB with:

launchctl start org.mongodb.mongod
launchctl stop org.mongodb.mongod

Note, the above plist solution was taken from this excellent Stack Overflow answer.

|improve this answer|||||

It is external now:

brew tap homebrew/services

brew services install, brew services install now work.

|improve this answer|||||

Theres is a useful GUI on the MongoDB website, if you don't want to manually modify files.


The MacOSX preferences pane for MongoDB aims to provide a simple and efficient user interface to control the status of a local MongoDB server, just like the MySQL Preferences Pane.

|improve this answer|||||

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .