安装 Mac 的包管理器 - homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
安装nginx服务器
brew install nginx
# 启动 nginx服务
sudo nginx
# 重新加载配置|重启|停止|退出 nginx
nginx -s reload|reopen|stop|quit
#测试配置是否有语法错误
nginx -t
开机启动nginx:
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/nginx/1.10.0/homebrew.mxcl.nginx.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
安装配置MYSQL服务器
brew install mysql
设置密码:
/usr/local/bin/mysqladmin -u root password 'new-password'
开机启动:
mkdir -p ~/Library/LaunchAgents/cp /usr/local/Cellar/mysql/5.7.12/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
安装PHP 和 php-fpm:
brew tap homebrew/dupes
brew tap josegonzalez/homebrew-php
brew install php56 --with-imap --with-tidy --with-debug --with-pgsql --with-mysql --with-fpm
export PATH="$(brew --prefix php54)/bin:$PATH"
设置php-fpm开机启动:
mkdir -p ~/Library/LaunchAgents
cp /usr/local/opt/php56/homebrew.mxcl.php56.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
mac下安装PHP扩展:
brew install php56-apcu php56-intl php56-redis php56-uuid php56-zookeeper
php56-thrift php56-solr php56-ssh2 php56-gmagick php56-kafka php56-libevent
php56-imagick php56-msgpack php56-geoip php56-mcrypt php56-swoole
php56-scrypt php56-xdebug php56-yaf php56-yaml php56-xhprof
php56-memcache php56-memcached php56-gearman