macOS的Homebrew换国内源

搜索了网上的该内容,都告诉如下方法:但是我用了C-shell,所以没有$(brew --repo)变量,实际上该变量就是指向目录:/usr/local/Homebrew。

git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git

brew update
————————————————
版权声明:本文为CSDN博主「YD-10-NG」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/sinat_38184748/article/details/99450330
git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git

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

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

brew update
————————————————
版权声明:本文为CSDN博主「YD-10-NG」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/sinat_38184748/article/details/99450330cp config config.old

所以具体过程改成了:

cd /usr/local/Homebrew/
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
cd Library/Taps/homebrew/homebrew-core
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
cd ../homebrew-cask
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
vi ~/.cshrc ## add the following line 
setenv HOMEBREW_BOTTLE_DOMAIN http://mirrors.ustc.edu.cn/homebrew-bottles

brew update
brew doctor # to check whether everything is OK. source ~/.cshrc

其实所有的配置文件在这些位置,名字是config:

/usr/local/Homebrew/.git
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/.git
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/.git

 

你可能感兴趣的:(macOS的Homebrew换国内源)