中文文档地址(https://brew.sh/index_zh-cn)
Homebrew是Mac OSX下使用的包管理工具,用来安装OSX系统中没有预装但是你需要的东西。它将软件包安装到独立目录,并在/usr/local目录下创建软链接。
安装Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
解决 “curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused” 错误
前往www.ipaddress.com网站查询raw.githubusercontent.com主机的真实IP:199.232.68.133
命令行
sudo vim /etc/hosts
修改/etc/hosts文件,添加以下内容:
199.232.68.133 raw.githubusercontent.com
然后在重新执行上面的安装命令
使用 阿里云 的 Homebrew 镜像源进行加速。
假设你没有更换过镜像源,执行 brew 命令安装应用的时候,下面3 个仓库地址将影响你的下载速度:brew.git、homebrew-core.git、homebrew-bottles。
首先,更换 brew.git
cd "$(brew --repo)"
git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
然后更换 homebrew-core.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
随后,运行brew config 来检查一下地址是否更新成功
更新一下源
brew update
最后更换 homebrew-bottles
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile