Daemons for a developer on Mac OS

How I solve the problem of maintaining long-running processes on my laptop

I am a developer and a linux system administrator who needs some daemons on my laptop, time to time. Managing these daemons, remembering their parameters and, most importantly remembering to run them is not an easy task. For all of these I decided to use supervisord.

To get supervisord, my suggestion is first to install python from homebrew and pip install supervisor.

Choose a folder for your supervisord (mine is ~/Can/supervisor/), create a conf.d and childlogs folder in it. For all files below, don’t forget to replace “/Users/canburak/” with your home path. Put the following in supervisor.conf:

supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
files = conf.d/*.conf

Fill your conf.d folder with your daemons. An example daemon file conf.d/dovecot.conf is:

command=/usr/local/sbin/dovecot ...

Finally, you need the supervisord to start with the system. Put the following to /Library/LaunchDaemons/com.agendaless.supervisord.plist

Copy paste from the gist

Add this to launchd: sudo launchctl load -w /Library/LaunchDaemons/com.agendaless.supervisord.plist

From now an you can simply add an alias supervisorctl=“supervisorctl -c ~/Can/supervisor/supervisor.conf” to your ~/.bash_profile and command your daemons easily.

Like what you read? Give Can Burak Çilingir a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.