Brew

安装

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

常用命令

$ brew help  //查看帮助信息
$ brew -v  //查看版本
$ brew update  //自我更新
$ brew install [包名]  //安装软件
$ brew uninstall [包名]  //卸载软件
$ brew upgrade  //更新所有包
$ brew upgrade [包名]  //更新指定包
$ brew info [包名]  //查看包信息

安装nginx

$ brew install nginx  //安装nginx
$ brew services start nginx  //启动nginx服务
$ brew services restart nginx  //重启nginx服务
$ nginx -t  //检查配置文件是否正确
$ nginx -s reload   //重新加载nginx配置

安装mysql

$ brew install mysql  //安装mysql
$ brew services start mysql  //启动mysql服务
$ mysql -uroot  //进入mysql

卸载Brew

$ cd `brew --prefix`
$ rm -rf Cellar
$ brew prune
$ rm `git ls-files`
$ rm -r Library/Homebrew Library/Aliases Library/Formula Library/Contributions
$ rm -rf .git
$ rm -rf ~/Library/Caches/Homebrew