1. mac终端执行命令/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)",无法建立连接或连接超时错误,错误信息如下:

curl: (28) Failed to connect to raw.githubusercontent.com port 443 after 75059 ms: Couldn't connect to server

fatal: unable to access ‘https://github.com/Homebrew/brew/’: Failed to connect to github.com port 443: Operation timed out

Failed to connect to raw.githubusercontent.com port 443: Connection refused

解决:

1)浏览器访问https://www.ipaddress.com,进入如下页面

mac安装brew遇到的一些问题_xcode


2)页面下拉到如图位置,输入域名,点击搜索

mac安装brew遇到的一些问题_mac_02

浏览器滚动至接近最下方,利用终端ping搜索到的ip,要ping通

mac安装brew遇到的一些问题_mac_03

3)在/etc/hosts中添加ip映射,如果映射的ip不对,则会提示超时等连接错误信息

mac安装brew遇到的一些问题_mac_04

  1. 长时间卡在 Downloading Command Line Tools for Xcode

解决:

1)终端输入:xcode-select --install

2)mac根据提示在接通电源的情况下安装xcode-select


  1. xcode-select: note: Command line tools are already installed. Use "Software Update" in System Settings or the softwareupdate command line interface to install updates

解决:

1)终端输入sudo xcode-select -p 查看xcode-select位置(默认在/Library/Developer/CommandLineTools)

2)删除xcode-select:sudo rm -rf /Library/Developer/CommandLineTools

3)重装xcode-select:xcode-select --install

  1. error: 835 bytes of body are still expected96 MiB | 46.00 KiB/s

fetch-pack: unexpected disconnect while reading sideband packet

fatal: early EOF

fatal: fetch-pack: invalid index-pack output

Failed during: /usr/bin/git fetch --force origin

解决:

终端输入:git config --global http.postBuffer 524288000

此时仍提示错误:Error: Failed to download https://formulae.brew.sh/api/formula.jws.json!

Failed during: /opt/homebrew/bin/brew update --force --quiet

如果还出现错误,建议删除homebrew并重新安装


用国内镜像源:

删除:/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh)"

安装:/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"


以上创作全凭经历回忆,希望能够帮助到您。本人从事软件开发有5年多的时间了,现在真的好想自主创业,可没人脉没资源的自己难免产生着很多焦虑,这里希望同行的你能带给我一点鼓励,让我能在软件这行继续坚持下去。