Mac通过清华镜像安装Homebrew

原文地址: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就安装完毕了。

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
您好!如果您想在国内使用Homebrew并加速安装速度,可以使用清华大学开源软件镜像站提供的镜像来安装Homebrew。以下是在Mac安装Homebrew的步骤: 1. 打开终端应用程序(Terminal),可以在Launchpad的"其他"文件夹中找到它。 2. 在终端中输入以下命令并按下回车键,以安装Homebrew: ```shell /bin/bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install.sh)" ``` 3. 安装过程可能需要一些时间,等待安装完成。 4. 安装完成后,您可以使用以下命令验证Homebrew是否正确安装: ```shell brew doctor ``` 如果看到"Your system is ready to brew."的提示,说明Homebrew已成功安装。 通过使用清华大学镜像站提供的国内镜像,您可以加快Homebrew的下载和更新速度。对于许多软件包,您只需将默认的Homebrew源更改为清华大学镜像即可。以下是如何更改Homebrew源为清华大学镜像的步骤: 1. 在终端中输入以下命令,备份当前Homebrew源: ```shell cd "$(brew --repo)" git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git ``` 2. 接下来,需要备份Homebrew核心(Homebrew Core)的源。输入以下命令备份Homebrew核心: ```shell cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git ``` 3. 最后,使用以下命令更新Homebrew: ```shell brew update ``` 现在,您已经成功更改了Homebrew的源为清华大学镜像,可以享受更快的下载和更新速度了!请注意,如果您之前已经安装Homebrew,可能需要重新安装某些软件包。 希望这些信息能对您有所帮助!如有任何问题,请随时提问。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值