国内源下载homebrew
时间: 2023-09-22 15:13:28 浏览: 108
要在国内下载Homebrew,可以选择中科大源或清华源。
中科大源的配置步骤如下:
1. 修改brew.git源:
```
git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git
```
2. 修改homebrew-core.git源:
```
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
```
3. 修改homebrew-cask.git源:
```
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
```
4. 配置homebrew-bottles:
- 对于bash用户,在`~/.bash_profile`文件中添加以下内容:
```
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles
source ~/.bash_profile
```
- 对于zsh用户,在`~/.zshrc`文件中添加以下内容:
```
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles
source ~/.zshrc
```
清华源的配置步骤如下:
1. 修改brew.git源:
```
git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
```
2. 修改homebrew-core.git源:
```
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
```
3. 修改homebrew-cask.git源:
```
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
```
4. 配置homebrew-bottles:
- 对于bash用户,在`~/.bash_profile`文件中添加以下内容:
```
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles
source ~/.bash_profile
```
- 对于zsh用户,在`~/.zshrc`文件中添加以下内容:
```
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles
source ~/.zshrc
```
如果你想一键安装Homebrew并使用国内源,可以执行以下命令:
```
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
```<span class="em">1</span><span class="em">2</span><span class="em">3</span><span class="em">4</span>
阅读全文