Logicky Blog

Logickyの開発ブログです

Mac El Capitan - Nginx, php-fpm, mysqlの自動起動

Nginxの自動起動設定

参考:Mac初心者がEl Capitanにnginx + php 環境を構築してハマったメモ その2

$ ln -sfv /usr/local/opt/nginx/*.plist ~/Library/LaunchAgents
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist

エラー出る。

/usr/local/Cellar/nginx/1.10.0/homebrew.mxcl.nginx.plist: Operation not permitted

パーミッションを変更する

$ sudo chmod 600 /usr/local/Cellar/nginx/1.10.0/homebrew.mxcl.nginx.plist
$ sudo chown root /usr/local/Cellar/nginx/1.10.0/homebrew.mxcl.nginx.plist

再度実行

$ sudo launchctl load ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist

php-fpmの自動起動設定

$ cp /usr/local/opt/php70/homebrew.mxcl.php70.plist ~/Library/LaunchAgents/
$ sudo chmod 600 ~/Library/LaunchAgents/homebrew.mxcl.php70.plist
$ sudo chown root ~/Library/LaunchAgents/homebrew.mxcl.php70.plist
$ sudo launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php70.plist

MySQLの自動起動設定

$ mysql --version
mysql  Ver 14.14 Distrib 5.7.12, for osx10.11 (x86_64) using  EditLine wrapper
$ cp /usr/local/Cellar/mysql/5.7.12/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/
$ sudo chmod 600 ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
$ sudo chown root ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
$ sudo  launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist