問(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
取消代理后重試一下,看一看是否能夠鏈接成功。
記錄一下踩得這些坑??