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.com
到hosts
查询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地址。