【開發筆記】-Mac下HomeBrew 更新源失敗問題


1、brew update 卡死問題
(1)依次替換以下brew源

#更新Homebrew
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

#更新Homebrew-core
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

#更新Homebrew-cask(最重要的一步,很多更新完國內源依然卡就是沒更新這個)
cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git

ps:如果沒有homebrew-cask這個目錄可以找到/usr/local/Library……下的相關目錄自己創建一個即可。

(2)選擇zsh或bash用戶,執行即可
zsh用戶

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles/' >> ~/.zshrc
source ~/.zshrc

bash用戶

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles/' >> ~/.bash_profile
source ~/.bash_profile


(3)擇一命令,更新brew

brew update -v  

or
brew update
-reset
2. brew install 總是顯示 No similarly named formulae found.問題
git -C $(brew --repository homebrew/core) checkout master
or
git -C $(brew --repository homebrew/core) reset --hard HEAD.

 3. Mac報錯:Error: The following directories are not writable by your user: /usr/local/share/man/man8 解決方案

首先打開終端,然后輸入:

sudo chown -R `whoami`:admin /usr/local/bin

接着系統會提醒你輸入密碼,輸入密碼回車之后接着輸入:

sudo chown -R `whoami`:admin /usr/local/share

之后就能在終端中用brew install 安裝文件了

ps:如果還是報錯的話,將3的命令中 /usr/local 后的目錄換成報錯的目錄,再次執行即可。

 

 

 


免責聲明!

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



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