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

yangfei@yangfeideMacBook-Pro Homebrew % brew install php@8.2
Warning: You are using macOS 10.15.
We (and Apple) do not provide support for this old version.
It is expected behaviour that some formulae will fail to build in this old version.
It is expected behaviour that Homebrew will be buggy and slow.
Do not create any issues about this on Homebrew's GitHub repositories.
Do not create any issues even if you think this message is unrelated.
Any opened issues will be immediately closed without response.
Do not ask for help from Homebrew or its maintainers on social media.
You may ask for help in Homebrew's discussions but are unlikely to receive a response.
Try to figure out the problem yourself and submit a fix as a pull request.
We will review it but may or may not accept it.

==> Fetching dependencies for php@8.2: apr, ca-certificates, openssl@3, apr-util, argon2, aspell, m4, autoconf, cmake, brotli, pkg-config, libnghttp2, libssh2, rtmpdump, lz4, xz, zstd, libunistring, gettext, libidn2, curl, libtool, unixodbc, freetds, libpng, freetype, fontconfig, nasm, jpeg-turbo, giflib, highway, imath, libtiff, little-cms2, openexr, webp, docbook, mpdecimal, readline, sqlite, python@3.12, icu4c@75, boost, source-highlight, asciidoc, docbook-xsl, bison, flex, doxygen, python@3.11, certifi, sphinx-doc, jpeg-xl, ninja, meson, libvmaf, yasm, aom, libavif, gd, automake, gmp, krb5, libpq, libsodium, libzip, oniguruma, openldap, pcre2, tidy-html5 and httpd
==> Fetching apr
==> Downloading https://raw.githubusercontent.com/Homebrew/homebrew-core/ae0014b96ba23df5de5d967b46bbd5b849f284f2/Formula/a/apr.rb

curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
Error: php@8.2: Failed to download resource "apr.rb"
Download failed: https://raw.githubusercontent.com/Homebrew/homebrew-core/ae0014b96ba23df5de5d967b46bbd5b849f284f2/Formula/a/apr.rb

1. HomebrewCN: Homebrew 国内安装脚本,快速部署 brew ,国内镜像 - Gitee.com

2.添加raw.githubusercontent.comhosts

查询IP地址:首先,你需要查询raw.githubusercontent.com最新IP地址。通常,你可以使用在线IP地址查询服务如IPAddress.com

https://www.ipaddress.com/ip-lookup

  • 编辑hosts文件
  • 使用以下命令之一编辑hosts文件:

    bash

    sudo vi /etc/hosts
    
    或者

    bash

    sudo nano /etc/hosts
  • 输入你的管理员密码。
  • 在文件中添加一行,格式如下:
    [IP地址] raw.githubusercontent.com
    
    其中[IP地址]是你查询到的raw.githubusercontent.com的IP地址。
  • 保存并关闭文件
  • 如果使用vi,按Esc键,然后输入:wq并按Enter
  • 如果使用nano,按Ctrl + X,然后按Y确认保存更改,最后按Enter
  • 清除DNS缓存:在终端中运行以下命令以使更改生效:

    bash

    sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

请注意,由于raw.githubusercontent.com的IP地址可能会变化,这种方法可能不是永久性的解决方案。你可能需要定期更新hosts文件中的IP地址。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值