homebrew换源
时间: 2023-11-07 13:05:59 浏览: 42
好的,关于homebrew换源,你可以按照以下步骤进行操作:
1. 首先备份原有的brew源:
```
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git
```
2. 替换为清华大学的源:
```
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
```
3. 更新brew并重置homebrew-core:
```
brew update
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
```
4. 最后再次更新brew即可。
```
brew update
```
相关问题
homebrew 更换镜像源
要更换Homebrew的镜像源,有两种临时和长期替换的方法。临时替换可以通过在终端中执行以下命令实现:
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles
这将临时将镜像源替换为清华大学的镜像源。
如果您希望长期替换镜像源,可以在终端中执行以下命令:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.***并将其添加到您的bash配置文件中,以便在每次启动终端时生效。
请确保在执行这些命令之前,您已经安装了Homebrew并具有sudo访问权限。您可以使用以下命令检查是否具有sudo访问权限:
sudo -v
另外,如果您使用的是Mac操作系统,您还可以使用以下命令自动安装Homebrew并更换镜像源:
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
这个命令将自动安装Homebrew并将其镜像源替换为清华大学的镜像源。请确保在执行此命令之前,您已经安装了zsh。
通过执行上述方法中的任何一种,您都可以更换Homebrew的镜像源。
homebrew 切换国内镜像源
要在 Homebrew 中切换国内镜像源,可以执行以下命令:
1. 首先备份 Homebrew 默认源文件:
```
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git
```
2. 替换为国内源:
```
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
```
或者
```
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
```
3. 更新 Homebrew:
```
brew update
```
4. 替换 Homebrew Core 源:
```
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
```
或者
```
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
```
5. 更新 Homebrew Core:
```
brew update
相关问题: