Homebrew是一款Mac OS平台下的軟件包管理工具。
安裝方法:命令行輸入
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
但是,此方法一般會因訪問外網(github)速度太慢而失敗。
因此,我們采用國內的鏡像源來安裝。
1.獲取brew_install文件,用>>將以上鏈接的下載腳本下載到本地文件上。
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install >> brew_instal
2.修改此文件內容,將
BREW_REPO = "https://github.com/Homebrew/brew".freeze CORE_TAP_REPO = "https://github.com/Homebrew/homebrew-core".freeze(有的版本不存在)
替換為清華大學的鏡像源
BREW_REPO = "https://mirrors.ustc.edu.cn/brew.git".freeze CORE_TAP_REPO = "https://mirrors.ustc.edu.cn/homebrew-core.git".freeze(不存在就不管)
3.用ruby(mac自帶)運行腳本
/usr/bin/ruby brew_install
若長時間停止執行,並出現
==> Tapping homebrew/core Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'.
的提示,則執行
git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1
最后,通過命令
brew -v
檢測是否安裝成功。
