Mac通过清华镜像安装Homebrew

前言:想学习一下Erlang,想通过homebrew安装一下环境,才发现新电脑还没有安装。通过官方命令在终端上安装时,发现小水管实在无法让人忍受。

龟速小水管

于是只能通过国内镜像来安装啦,中间也遇到点问题下面把过程记录一下。
下面使用清华镜像

1.通过编辑install文件来使用镜像地

1.1获取brew_install

curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install >> brew_instal

1.2编辑brew_instal

vim brew_instal

1.3在Vim模式下,按i,进入编辑模式,在BREW_REPO和CORE_TAP_REPO前加#注释掉,写入镜像地址代替

BREW_REPO = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git".freeze

CORE_TAP_REPO = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git".freeze

替换为镜像地址

1.4按ESC退出编辑模式,输入:wq Return保存退出

2安装

2.1安装,运行install

/usr/bin/ruby ~/brew_install

2.2 出现如下代码时,不用等了,直接关掉命令窗口

==> Tapping homebrew/core
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...

2.3进入下面的 Taps 目录,clone homebrew-core

cd /usr/local/Homebrew/Library/Taps/homebrew

git clone https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

3把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

4 这时,终端会显示Already up-to-date.到此,homebrew就安装完毕了,我可以去安装Erlang啦

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容