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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM