Installing databases as services with Homebrew on a Mac

Apr 4, 2016

Homebrew enables you to install certain packages as services that start automatically with your system.

First steps

Update your homebrew references and install services package to run the servers in the background.

    brew update
    brew tap homebrew/services

Installing services

Now you can install MongoDB, Redis or MySQL. Install whatever you need depending on your setup.

    brew install mongodb
    brew install redis
    brew install mysql

##Starting services

You can then control services with syntax typically seen in service launchers.

    brew services start [service]
    brew services stop [service]
    brew services restart [service]

Replace [service] bit with mongodb, redis, mysql or whatever service you need to run and you’re done.

Some debug options

    brew services list
    brew services cleanup