美文网首页IOS开发与实践
Mac通过清华镜像安装Homebrew

Mac通过清华镜像安装Homebrew

作者: NGC_6960 | 来源:发表于2018-08-07 17:15 被阅读0次

前言:想学习一下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啦

相关文章

网友评论

    本文标题:Mac通过清华镜像安装Homebrew

    本文链接:https://www.haomeiwen.com/subject/tgpavftx.html