macOS home brew国内下载速度慢,替换清华大学源

时间:2019-10-08 12:23:51   收藏:0   阅读:1148

第一步,获取install文件

把官网给的脚本拿下来

1.打开terminal.app

粘贴

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

第二步,更改脚本中的资源链接,替换成清华大学的镜像

获取的文件在:/Users/wy 目录下 brew_install

2.使用sublimeText打开文件

把这句屏蔽掉

BREW_REPO = "https://github.com/Homebrew/brew".freeze

加上这两句

BREW_REPO = "https://mirrors.ustc.edu.cn/brew.git".freeze
CORE_TAP_REPO = "https://mirrors.ustc.edu.cn/homebrew-core.git".freeze

第三步,执行脚本

3.粘贴到终端

/usr/bin/ruby brew_install

遇到提示会车确认

控制台输出

wydeMacBook-Air:~ wy$ /usr/bin/ruby brew_install
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew

Press RETURN to continue or any other key to abort
==> Downloading and installing Homebrew...
remote: Counting objects: 262, done.
remote: Compressing objects: 100% (204/204), done.
remote: Total 262 (delta 121), reused 111 (delta 45)
Receiving objects: 100% (262/262), 138.17 KiB | 2.19 MiB/s, done.
Resolving deltas: 100% (121/121), done.
From https://mirrors.ustc.edu.cn/brew
 * [new tag]             1.16                 -> 1.16
 * [new tag]             backup/brew-cask-style-14-54-55 -> backup/brew-cask-style-14-54-55
 * [new tag]             backup/create-cache-00-29-47 -> backup/create-cache-00-29-47
 * [new tag]             backup/days-03-02-52 -> backup/days-03-02-52
 * [new tag]             backup/days-03-02-59 -> backup/days-03-02-59
 * [new tag]             backup/days-19-30-23 -> backup/days-19-30-23
 * [new tag]             backup/gpg-verification-01-53-16 -> backup/gpg-verification-01-53-16
 * [new tag]             backup/remove-popen-read-19-56-50 -> backup/remove-popen-read-19-56-50
 * [new tag]             backup/remove-popen-read-20-00-21 -> backup/remove-popen-read-20-00-21
HEAD is now at 203f8d66a Merge pull request #6547 from MikeMcQuaid/sandbox-allow-more-tty
Already up-to-date.
==> Installation successful!

==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations
==> Next steps:
- Run `brew help` to get started
- Further documentation: 
    https://docs.brew.sh

完成。

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!