openssl@1.1: macos 安装(老款 macos 11)

在macos下安装 openssl@1.1
更新于: 2024-11-10 13:53:45

直接使用 brew

发现官方源已经不维护了

brew install openssl@1.1
$ p brew install openssl@1.1
Warning: You are using macOS 11.
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.

Error: openssl@1.1 has been disabled because it is not supported upstream! It was disabled on 2024-10-24.
为什么我需要安装这个

使用 rbenv 源

报错,发现是 运行 `ps aux | grep brew` 查看是否有其他brew相关进程在运行 因为我的 brew 正在安装其它软件

$ p brew install rbenv/tap/openssl@1.1
==> Installing openssl@1.1 from rbenv/tap
Error: A `brew install rbenv/tap/openssl@1.1` process has already locked /usr/local/Cellar/ca-certificates.
Please wait for it to finish or terminate it to continue.

可能原因分析

这个错误通常意味着 `brew install` 过程中,有另一个进程或操作占用了 `/usr/local/Cellar/ca-certificates` 目录的锁,导致当前安装无法继续。具体原因可能有以下几种:

1. **多次运行brew命令**:你可能在另一个终端窗口或标签页中同时运行了 `brew install` 或其他涉及该目录的操作。
2. **意外中断的进程**:如果上次执行 `brew install` 的进程被强制关闭(例如通过 `Ctrl+C`),可能会留下锁定文件。
3. **权限问题**:有时权限问题也会导致brew无法正确解除锁定。确认是否以管理员身份运行,且有权限修改相关目录。
4. **brew本身的问题**:在极少数情况下,Homebrew可能会因为某些冲突或内部问题而未能正确管理锁。

### 解决方法

1. **确认并终止其他brew进程**:
   - 运行 `ps aux | grep brew` 查看是否有其他brew相关进程在运行。若有,可以尝试 `kill <进程ID>` 终止它们。

2. **手动清理锁文件**:
   - 如果没有其他brew进程在运行,进入 `/usr/local/Cellar/ca-certificates` 目录,手动删除锁文件(一般以 `.lock` 为后缀)。例如:`rm /usr/local/Cellar/ca-certificates/*.lock`。

3. **重新尝试安装**:
   - 锁文件清理后,可以尝试再次执行 `brew install rbenv/tap/openssl@1.1`。

如果问题仍然存在,可以通过 `brew doctor` 命令检查Homebrew的健康状态,它会提供一些可能的修复建议。

安装好了

A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/openssl@1.1/certs

and run
  /usr/local/opt/openssl@1.1/bin/c_rehash

openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have openssl@1.1 first in your PATH, run:
  echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.profile

For compilers to find openssl@1.1 you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

For pkg-config to find openssl@1.1 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"
==> Summary
🍺  /usr/local/Cellar/openssl@1.1/1.1.1w: 8,095 files, 18.5MB, built in 5 minutes 5 seconds
==> Running `brew cleanup openssl@1.1`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
安装 ruby 会自动指定

openssl@1.1 报错

brew unlink openssl@3
brew link --overwrite openssl@1.1


If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.profile