mac 安裝homebrew

問(wèn)題場(chǎng)景:

新mac使用brew命令時(shí) 顯示

zsh : command not found :brew

分析:

未安裝brew命令

解決:

安裝brew命令就好了啊
1.去homebrew官網(wǎng)(https://brew.sh/),使用官方提供的命令行

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

2.國(guó)內(nèi)用戶會(huì)遇到以下問(wèn)題,鏈接github失敗

fatal: unable to access ‘https://github.com/Homebrew/brew/’: Failed to connect to github.com port 443: Operation timed out
Error: Fetching /usr/local/Homebrew failed!

3.替換homebrew安裝源
替換homebrew默認(rèn)源

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

替換homebrew-core源

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

重新安裝重試
4.如果還沒(méi)有解決

Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
fatal: unable to access 'https://github.com/Homebrew/homebrew-core/': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 
Error: Failure while executing: git clone https://github.com/Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1
Error: Failure while executing: /usr/local/bin/brew tap homebrew/core
Failed during: /usr/local/bin/brew update --force

不要急,我們手動(dòng)處理
依次輸入以下命令行

cd /usr/local/Homebrew/Library/Taps/
mkdir homebrew
cd homebrew
git clone https://mirrors.ustc.edu.cn/homebrew-core.git
brew update

到這應(yīng)該就能解決問(wèn)題啦~~~

tips:意外情況
在下載過(guò)程中如果出現(xiàn)了

Failed to connect to 127.0.0.1 port 1080: Connection refused

這種拒絕鏈接的提示,只要 查看并取消代理proxy
強(qiáng)勢(shì)取消代理命令

$ unset http_proxy
$ unset ftp_proxy
$ unset all_proxy
$ unset https_proxy
$ unset no_proxy

取消代理后重試一下,看一看是否能夠鏈接成功。

記錄一下踩得這些坑??

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

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

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