官方解釋:
Homebrew是以最簡單,最靈活的方式來安裝蘋果公司在MacOS中不包含的UNIX工具。
官網:https://brew.sh/index_zh-cn.html
Git倉庫地址:https://github.com/Homebrew/b...html
a.環境,首先須要安裝依賴包 Xcode,彈出來的對話框請一路點擊 OK,過程長短看網速。git
xcode-select --install
b.安裝,打開終端,複製粘貼,大約1分鐘左右,下載完成,過程當中須要輸入密碼,其餘無需任何操做:github
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
c.檢查,最後執行這個命令,沒有報錯則可確認安裝成功(通常輸出是 "Your system is ready to brew.")。這樣海外和已經有系統全局代理設置的朋友們就能夠直接使用 brew 命令安裝軟件了。shell
brew doctor
d.卸載,有安裝就要有卸載,打開終端,複製粘貼。 其實只用把上面安裝的install換成uninstall就好了。xcode
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
直接使用 Homebrew 還須要更改默認源,否則誰用誰想打人,緣由你懂的。如下是將默認源替換爲國內 USTC 源的方法。ruby
a.替換核心軟件倉庫bash
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
b.替換 cask 軟件倉庫(提供 macOS 應用和大型二進制文件)curl
cd "$(brew --repo)"/Library/Taps/caskroom/homebrew-cask git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
c.替換 Bottles 源(Homebrew 預編譯二進制軟件包)工具
bash(默認 shell)用戶:url
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile source ~/.bash_profile
zsh 用戶:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc source ~/.zshrc
參考:
Homebrew 中文主頁
https://brew.sh/index_zh-cn.html
Homebrew Bottles 源使用幫助
http://mirrors.ustc.edu.cn/he...
Homebrew Cask 源使用幫助
http://mirrors.ustc.edu.cn/he...
Homebrew Core 源使用幫助