I constantly switch from a project to another, even multiple times per day, and each of them has a different set of services needed to run (eg. databases, queues). To remember all the paths and the options needed by each of them it's almost impossible, and it will slow down the time-to-code, so I submitted this pull request: https://github.com/mxcl/homebrew/pull/11581
Basically, it adds
brew start/stop command, both for foreground and background processes. Unfortunately that patch requires an amend of all the existing recipes and the change of the
Formula interface, with the add of
#stop_command. That causes the patch to be still pending and I don't think it will be approved.
Apparently, there is another way to achieve this goal: brew sub-commands.
The homebrew architecture is pluggable, so if you have in your
$PATH an executable (chmod +x) script called
brew-services.rb it adds a
services sub-command. I have put this in my
~/bin https://gist.github.com/2365430 and my tmux scripts are using it in this way:
brew services restart postgres
brew services restart redis