问题场景:
新mac使用brew命令时 显示
zsh : command not found :brew
分析:
未安装brew命令
解决:
安装brew命令就好了啊
1.去homebrew官网(https://brew.sh/),使用官方提供的命令行
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
2.国内用户会遇到以下问题,链接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默认源
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.如果还没有解决
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
不要急,我们手动处理
依次输入以下命令行
cd /usr/local/Homebrew/Library/Taps/
mkdir homebrew
cd homebrew
git clone https://mirrors.ustc.edu.cn/homebrew-core.git
brew update
到这应该就能解决问题啦~~~
tips:意外情况
在下载过程中如果出现了
Failed to connect to 127.0.0.1 port 1080: Connection refused
这种拒绝链接的提示,只要 查看并取消代理proxy
强势取消代理命令
$ unset http_proxy
$ unset ftp_proxy
$ unset all_proxy
$ unset https_proxy
$ unset no_proxy
取消代理后重试一下,看一看是否能够链接成功。
记录一下踩得这些坑😭