美文网首页
Homebrew 安装和配置源

Homebrew 安装和配置源

作者: Matrix0 | 来源:发表于2019-12-07 17:22 被阅读0次

1 安装Homebrew

将下列命令复制到终端,运行

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2 将Homebrew切换到国内镜像

将homebrew切换到国内镜像源

  • 切换brew
git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
  • 切换homebrew-core
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
  • 切换homebrew-cask
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
  • 切换Homebrew-bottles
    使用bash
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile

使用zsh

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc
  • 更新homebrew
brew update

将homebrew复原

# brew
git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git
#homebrew-core
git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/homebrew-core.git
#homebrew-cask
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://github.com/Homebrew/homebrew-cask.git

brew update

参考资料

Homebrew
Homebrew 镜像使用帮助
Homebrew-bottles 镜像使用帮助

相关文章

网友评论

      本文标题:Homebrew 安装和配置源

      本文链接:https://www.haomeiwen.com/subject/pxbugctx.html