brew 全稱Homebrew 是Mac OSX上的軟件包管理工具
Homebrew 安裝和卸載工具 只用一行命令就能完成
官方地址: http://brew.sh/index.html
mac 自帶ruby
打開命令行 terminal
輸入 :
- ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
假如已經安裝了 輸入如下命令
- ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
命令行輸出:

2) brew 使用方法
命令行 輸入: brew
輸出:
- Example usage:
- brew [info | home | options ] [FORMULA...]
- brew install FORMULA...
- brew uninstall FORMULA...
- brew search [foo]
- brew list [FORMULA...]
- brew update
- brew upgrade [FORMULA...]
- brew pin/unpin [FORMULA...]
- Troubleshooting:
- brew doctor
- brew install -vd FORMULA
- brew [--env | config]
- Brewing:
- brew create [URL [--no-fetch]]
- brew edit [FORMULA...]
- open https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Formula-Cookbook.md
- Further help:
- man brew
- brew home
3) 安裝工具
舉個栗子: wget 這個工具
輸入命令: brew install wget
如圖:
4) 卸載
拿上面的栗子: wget 工具
輸入命令 brew uninstall wget
5) 工具安裝的目錄
Homebrew 會將套件安裝到獨立目錄,並將文件軟鏈接至/usr/local 。
- $ cd /usr/local
- $ find Cellar
- Cellar/wget/1.16.1
- Cellar/wget/1.16.1/bin/wget
- Cellar/wget/1.16.1/share/man/man1/wget.1
- $ ls -l bin
- bin/wget -> ../Cellar/wget/1.16.1/bin/wget
Homebrew 的所有文件均會被安裝到預定義目錄下,所以無需擔心 Homebrew 的安裝位置。
6) 其他命令
brew list 列出已安裝的軟件
brew update 更新brew
brew home 用瀏覽器打開brew的官方網站
brew info 顯示軟件信息
brew deps 顯示包依賴
更多命令請看: https://git.io/brew-docs