Homebrew/Linuxbrew 更換數據源爲: 清華鏡像

 


# 步驟一

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

# 步驟二

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

#步驟三
 

brew update

 

 

--------------------------

Homebrew/Linuxbrew 鏡像使用幫助

注:該鏡像是 Homebrew/Linuxbrew 的 formula 索引的鏡像(即 brew update 時所更新內容)。本鏡像站同時提供相應的二進制預編譯包的鏡像,請參考 Homebrew bottles 鏡像使用幫助 和 Linuxbrew bottles 鏡像使用幫助

替換現有上游

# brew 程序本身,Homebrew/Linuxbrew 相同
git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

# 以下針對 mac OS 系統上的 Homebrew
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
git -C "$(brew --repo homebrew/cask-fonts)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-fonts.git
git -C "$(brew --repo homebrew/cask-drivers)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-drivers.git

# 以下針對 Linux 系統上的 Linuxbrew
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/linuxbrew-core.git

# 更換後測試工作是否正常
brew update

復原

(感謝Snowonion Lee提供說明)

# brew 程序本身,Homebrew/Linuxbrew 相同
git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git

# 以下針對 mac OS 系統上的 Homebrew
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
git -C "$(brew --repo homebrew/cask-fonts)" remote set-url origin https://github.com/Homebrew/homebrew-cask-fonts.git
git -C "$(brew --repo homebrew/cask-drivers)" remote set-url origin https://github.com/Homebrew/homebrew-cask-drivers.git

# 以下針對 Linux 系統上的 Linuxbrew
git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/linuxbrew-core.git

# 更換後測試工作是否正常
brew update

安裝 Linuxbrew 時使用 tuna 鏡像 (可用 sudo)

0. 安裝 git
1. 下載 https://raw.githubusercontent.com/Linuxbrew/install/master/install-ruby
2. 將其中 https://homebrew.bintray.com/bottles-portable-ruby/ 換爲 https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/bottles-portable-ruby/
3. 運行 ./install-ruby 安裝 portable ruby
4. export PATH=/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/current/bin:$PATH # ==> Add Ruby to your PATH
5. 下載 https://raw.githubusercontent.com/Linuxbrew/install/master/install
6. 將其中 https://github.com/Homebrew/brew 換爲 https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
7. 運行 ./install 安裝 brew
8. 執行到 “==> Tapping homebrew/core” 時 Ctrl-C
9. export PATH=/home/linuxbrew/.linuxbrew/Homebrew/bin:$PATH # 將 brew 添加到 PATH
10. git clone https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/linuxbrew-core.git "$(brew --repo homebrew/core)"
11. 再次運行 ./install 即可到達安裝成功結果

 

 

 

 

 

 

 

 

 

 

 

 

https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章