一、安装brew
1、安装brew
curl -LsSf http://github.com/mxcl/homebrew/tarball/master | sudo tar xvz -C/usr/local --strip 1
2、安装完成后执行
brew
提示:Please run brew update!
3、按照提示更新,执行
brew update
报错:Error: /usr/local must be writable!
4、赋给/usr/local目录权限,执行sudo chown -R $(whoami) /usr/local,即
sudo chown -R sunyifeng /usr/local
其中sunyifeng为系统当前用户名。
5、再次执行brew update
注意有错误提醒:
6、按照提示删除/usr/local/share/doc/homebrew,执行
rm -r -f /usr/local/share/doc/homebrew
7、再次执行
brew update
安装更新成功:
二、使用brew
命令行下执行brew,用法提示如下:
Example usage:
brew search [TEXT|/REGEX/]
brew (info|home|options) [FORMULA...]
brew install FORMULA...
brew update
brew upgrade [FORMULA...]
brew uninstall FORMULA...
brew list [FORMULA...]
Troubleshooting:
brew config
brew doctor
brew install -vd FORMULA
Developers:
brew create [URL [--no-fetch]]
brew edit [FORMULA...]
https://github.com/Homebrew/brew/blob/master/docs/Formula-Cookbook.md
Further help:
man brew
brew help [COMMAND]
brew home
常用命令有安装和卸载等,以安装和卸载autojump为例:
安装:sudo brew install autojump
卸载:sudo brew uninstall wget
查看安装软件的话,命令如下:
sudo brew search /apache*/
注意/apache*/是使用的正则表达式,用/分割。