【2021.1.21更新】直接使用现成的国内镜像源,执行下面的命令,选1(亲测速度最快),如果不行,再换成其他源
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
【2020-3-21】最近换了Mac,安装Homebrew很慢(以前好像并没有这么慢),Downloading and installing Homebrew...只有10KB/S.解决方法主要思路是把git切换为清华镜像,话不多说,直接看步骤吧.

1.用safari打开“https://raw.githubusercontent.com/Homebrew/install/master/install.sh”,把里面的文本复制下来,在桌面创建文本文件“brew_install”,粘贴.
2.搜索:
BREW_REPO="https://github.com/Homebrew/brew"
替换成:
BREW_REPO="https://mirrors.ustc.edu.cn/brew.git"
保存.
3.打开terminal,运行命令:/bin/bash + 刚才的brew_install文件,比如:
/bin/bash /Users/admin/Desktop/brew_install

4.进入下面的 Taps 目录,clone homebrew-core
cd /usr/local/Homebrew/Library/Taps/homebrew (如果没有homebrew,新建homebrew文件夹)
git clone https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
5.把homebrew repo切换为清华镜像
cd "$(brew --repo)"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
brew update
PS:如果有报错:curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused,可以通过这个命令解决:sudo gem install redis
网友评论