brew 切換源

切換到國內(nèi)源

# 替換brew.git:
$ cd "$(brew --repo)"
# 中國科大:
$ git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
# 清華大學(xué):
$ git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/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
# 清華大學(xué):
$ git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

# 替換homebrew-bottles:
# 中國科大:
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
$ source ~/.bash_profile
# 清華大學(xué):
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
$ source ~/.bash_profile

# 應(yīng)用生效:
$ brew update

切換到官方源

# 重置brew.git:
$ cd "$(brew --repo)"
$ git remote set-url origin https://github.com/Homebrew/brew.git

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

報錯

$ brew update
fatal: Could not resolve HEAD to a revision
Already up-to-date.
$ brew update --verbose
Checking if we need to fetch /opt/homebrew...
Checking if we need to fetch /opt/homebrew/Library/Taps/homebrew/homebrew-cask...
Fetching /opt/homebrew...
Checking if we need to fetch /opt/homebrew/Library/Taps/homebrew/homebrew-core...
Fetching /opt/homebrew/Library/Taps/homebrew/homebrew-core...
Updating /opt/homebrew...
Branch 'master' set up to track remote branch 'master' from 'origin'.
Switched to and reset branch 'master'
Your branch is up to date with 'origin/master'.
Switched to and reset branch 'stable'
Current branch stable is up to date.

# 進入這個地址
Updating /opt/homebrew/Library/Taps/homebrew/homebrew-core...
fatal: Could not resolve HEAD to a revision
Already up-to-date.

$ cd /opt/homebrew/Library/Taps/homebrew/homebrew-core            
homebrew-core (master) ? ll                                           
total 0
drwxr-xr-x   3 machao  admin   96 12  2 12:14 .
drwxr-xr-x   4 machao  admin  128 12  2 12:49 ..
drwxr-xr-x  12 machao  admin  384 12  2 14:20 .git

# 從新操作
$ git fetch --prune origin                     
$ git pull --rebase origin master              
From https://mirrors.ustc.edu.cn/homebrew-core
 * branch                    master     -> FETCH_HEAD
$ brew update
Already up-to-date.
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 1.問題描述 ??在Mac上安裝brew時,如果使用官方推薦的方式,會耗費很長時間,并且也不一定能成功 2. 解決...
    shandingdongren閱讀 54,664評論 8 19
  • 1、通過CocoaPods安裝項目名稱項目信息 AFNetworking網(wǎng)絡(luò)請求組件 FMDB本地數(shù)據(jù)庫組件 SD...
    陽明AI閱讀 16,170評論 3 119
  • 一閃一暗 明滅沒有節(jié)奏 與時間同行 在夜的包裹中 它沉默 像死去的風(fēng)聲 安靜的 存在并呼吸著 游動的火光卷帶著它過...
    光皂閱讀 252評論 0 1
  • 正月十四,天然居,岳陽樓。 時光流轉(zhuǎn),二十四年宛如昨天,突然又成了怯怯地說不出話來的那個孩子,在恩...
    NFEX吳窮閱讀 432評論 1 3
  • 我不知道什么是最好的結(jié)局,婚姻不是,離別更加不對。愛情在最開始就達到了最好,怎么走都是下坡路。切實的擁有、陪伴和相...
    入世的鷺鷥閱讀 290評論 0 0

友情鏈接更多精彩內(nèi)容