Mac通过清华镜像安装Homebrew

本文详细介绍了如何通过编辑Homebrew的安装脚本来配置使用清华镜像,包括获取并编辑安装文件、设置镜像地址、安装过程及切换repo至清华镜像的步骤,帮助用户加速Homebrew的软件包下载。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原文地址:https://www.jianshu.com/p/67db55780450

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就安装完毕了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值