Homebrew 的源更换为淘宝的镜像

游客2024-05-27 02:34:29

进入 Homebrew 目录:

确保你在 Homebrew 安装目录中。通常,Homebrew 的安装目录是 /usr/local/Homebrew 或者 /opt/homebrew。你可以使用以下命令进入 Homebrew 目录:

cd /usr/local/Homebrew

或者,如果你的 Homebrew 安装在 /opt/homebrew,m芯片则:

cd /opt/homebrew

修改 Homebrew 的源:

使用 git 命令将 Homebrew 的源更换为淘宝的镜像:

git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask
git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-cask.git

对于 M1 芯片的 Mac,路径应该是:

cd /opt/homebrew
git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
cd /opt/homebrew/Library/Taps/homebrew/homebrew-core
git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
cd /opt/homebrew/Library/Taps/homebrew/homebrew-cask
git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-cask.git

更新 Homebrew:

修改源之后,运行以下命令来更新 Homebrew,使更改生效:

brew update