homebrew代理設置


方法一

brew用curl下載,所以給curl掛上socks5的代理即可。

在~/.curlrc文件中輸入代理地址即可。

socks5 = "127.0.0.1:1080" 

方法二:替換源

替換為中科大源

  • 替換brew.git:
cd "$(brew --repo)" git remote set-url origin https://mirrors.ustc.edu.cn/brew.git 
  • 替換homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
  • 替換homebrew-cask.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-cask" git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
  • 替換Homebrew Bottles源:
    就是在/.bashrc或者/.zshrc文件末尾加
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles 

這兩個文件可以自己創建,/.bashrc和/.bash_profile都可以

重置源

  • 重置brew.git
cd "$(brew --repo)" git remote set-url origin https://github.com/Homebrew/brew.git 
  • 重置homebrew-core:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin https://github.com/Homebrew/homebrew-core.git
  • 重置homebrew-cask:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-cask" git remote set-url origin https://github.com/Homebrew/homebrew-cask.git
 

設置代理

為brew設置國外代理,mac的socks5代理設置:

start_proxy() {
    export ALL_PROXY=socks5://19.68.6.32:1080
}
stop_proxy() {
    unset ALL_PROXY
}

mac的http代理設置:

start_proxy() {
export http_proxy=12.168.6.32:8118
export https_proxy=12.18.6.32:8118
}
stop_proxy() {
unset http_proxy
unset https_proxy
 }

 

github地址

brew使用的github地址為:https://github.com/Homebrew

 

使用brew --repo查看brew的本地倉庫地址:

 

 

 

來源:https://www.jianshu.com/p/005963a4d843

https://mirrors.ustc.edu.cn/help/brew.git.html


免責聲明!

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



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