大部分安装完都会有一个plist,下面以nginx为例:
1.把plist拷到/Library/LaunchDaemons
sudo cp /usr/local/opt/nginx/*.plist /Library/LaunchDaemons
2.【可选】修改plist参数或增加其他(增加日志文件存放位置等)
3.修改权限
sudo chown root:wheel /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
4.启动
sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
sudo launchctl start homebrew.mxcl.nginx
参考:
http://stepquick.net/blog/2014/04/28/start-nginx-at-launch-on-mavericks/
https://alicoding.com/how-to-start-mongodb-automatically-when-starting-your-mac-os-x/
时间: 2024-10-03 21:58:09