安装Homebrew时报错 curl: (7) Failed to connect to raw.githubusercontent.com port 443: Operation timed out

Mac安装Homebrew时报错:

curl: (7) Failed to connect to raw.githubusercontent.com port 443: Operation timed out

第一步:
下载 brew_install.rb,链接:https://pan.baidu.com/s/1rVh8bY73NLc77cQYN_2HoQ 密码:n3si
第二步,cd 到下载的目录,执行 ruby brew_install.rb

==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
==> The Xcode Command Line Tools will be installed.

Press RETURN to continue or any other key to abort
==> Searching online for the Command Line Tools
==> /usr/bin/sudo /usr/bin/touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
Password:
==> Installing Command Line Tools for Xcode-11.3
==> /usr/bin/sudo /usr/sbin/softwareupdate -i Command\ Line\ Tools\ for\ Xcode-11.3
Software Update Tool

Downloading Command Line Tools for Xcode

如果你卡在 Downloading Command Line Tools for Xcode,那么另起一个终端执行 xcode-select --install,点击弹框,选择 安装

Downloading Command Line Tools for Xcode

Downloaded Command Line Tools for Xcode
Installing Command Line Tools for Xcode
Done with Command Line Tools for Xcode
Done.
==> /usr/bin/sudo /bin/rm -f /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
Password:
Sorry, try again.
Password:
==> /usr/bin/sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools
==> Downloading and installing Homebrew...
HEAD is now at f5ba503aa Merge pull request #7160 from MikeMcQuaid/check_core_git_status
fatal: It seems that there is already a rebase-apply directory, and
I wonder if you are in the middle of another rebase.  If that is the
case, please try
    git rebase (--continue | --abort | --skip)
If that is not the case, please
    rm -fr ".git/rebase-apply"
and run me again.  I am stopping in case you still have something
valuable there.

To restore the stashed changes to /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core run:
  'cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core && git stash pop'
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/linuxbrew-bottles/bottles-portable-ruby/portable-ruby-2.6.3.mavericks.bottle.tar.gz
##O#- #                                                                        
curl: (22) The requested URL returned error: 404 
==> Downloading https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.6.3/portable-ruby-2.6.3.mavericks.bottle.tar.gz
######################################################################### 100.0%####                                                                        5.5%
curl: (56) LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
Error: Checksum mismatch.
Expected: ab81211a2052ccaa6d050741c433b728d0641523d8742eef23a5b450811e5104
  Actual: 23d5663861495b76d5b542ddb9b6912ba664fa17dc6acc45f93ccf204db13739
 Archive: /Users/xxx/Library/Caches/Homebrew/portable-ruby-2.6.3.mavericks.bottle.tar.gz
To retry an incomplete download, remove the file above.
Error: Failed to upgrade vendor Ruby.
/usr/local/Homebrew/Library/Homebrew/brew.rb:10:in `
': Homebrew must be run under Ruby 2.6! You're running 2.3.7. (RuntimeError) Failed during: /usr/local/bin/brew update --force

好吧,失败又来了,网络的问题,如果你这个时候重新执行 ruby brew_install.rb,会提示

Already downloaded: /Users/xxx/Library/Caches/Homebrew/portable-ruby-2.6.3.mavericks.bottle.tar.gz

所以你得先执行

rm /Users/xxx/Library/Caches/Homebrew/portable-ruby-2.6.3.mavericks.bottle.tar.gz

再继续执行 ruby brew_install.rb,然后继续等下载完成即可,当出现 Installation successful!,代表你大功告成。

你可能感兴趣的:(安装Homebrew时报错 curl: (7) Failed to connect to raw.githubusercontent.com port 443: Operation timed out)