官方解释:
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 源使用帮助