简介Homebrew是Mac系统的软件包管理工具,其功能类似Centos中的yum。使用环境依赖64位的Intel CPUmacOS 10.12或者更高版本的操作系统Xcode命令行工具(安装方法:xcode-select –install)与bourne bash兼容的shell,例如bash或者zsh安装Homebrew/usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"卸载Homebrewruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"更新Homebrew需要注意这个指令除了会更新Homebrew外也会更新使用Homebrew安装的包brew updateHomebrew基本用法使用Homebrew安装软件:brew install wget使用Homebrew卸载软件:brew uninstall wget使用Homebrew更新软件(Homebrew也会更新):brew upgrade wget列出Homebrew安装的软件:brew list查看Homebrew安装的软件信息:brew info wget检索Homebrew软件库:brew search wget检测Homebrew问题:brew doctorbrew services简介在Centos中有个管理后台运行的服务的工具systemctl而在Mac中可以使用brew services来代替其(Mac中没有systemctl)基本用法列出所有brew services运行中服务:brew services list暂停并注销未使用的后台服务:brew services cleanup运行服务(不会注册为跟随系统启动自动运行的服务):brew services run nginx运行后台服务(同时会注册为跟随系统启动自动运行的服务):brew services start nginx暂停并注销服务:brew services stop nginx重启并注册服务:brew services restart nginx参考资料Homebrew中文官网