OS X下使用Homebrew来管理服务

使用Homebrew时,经常有一系列的服务要安装启动,通常的做法是copy一个plist文件到~/Library/LaunchAgents目录下再launchctl load一下,比较麻烦。

今天发现了一个不错的玩意-brew services

  1. 安装: brew tap gapple/services
  2. 使用: brew services restart mysql

下面是我的brew services list

$ brew services list
influxdb   started      658 /Users/khsing/Library/LaunchAgents/homebrew.mxcl.influxdb.plist
dnsmasq    started    34881 /Users/khsing/Library/LaunchAgents/homebrew.mxcl.dnsmasq.plist
nginx      started    39552 /Users/khsing/Library/LaunchAgents/homebrew.mxcl.nginx.plist
postgresql started      676 /Users/khsing/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
php56      started    45046 /Users/khsing/Library/LaunchAgents/homebrew.mxcl.php56.plist
redis      started      668 /Users/khsing/Library/LaunchAgents/homebrew.mxcl.redis.plist
mysql      started    34225 /Users/khsing/Library/LaunchAgents/homebrew.mxcl.mysql.plist

而且这个还可以帮助清理brew services cleanup,居家旅行必备。

参考来源:Starting and Stopping Background Services with Homebrew

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.