mac清华镜像安装Homebrew

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

1.1获取脚本写到brew_install文件

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

1.2编辑brew_instal,将BREW_REPO和CORE_TAP_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

2、安装

2.1安装,运行brew_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安装完毕。

你可能感兴趣的:(php)