我使用的是 macOS Big Sur。我通过 Homebrew 安装了 OpenSSL,如下所示:
$ brew install openssl
Updating Homebrew...
==> Auto-updated Homebrew!
Updated Homebrew from 40a7a0119 to f50b87031.
Updated 2 taps (homebrew/core and homebrew/cask).
==> Updated Formulae
Updated 24 formulae.
==> Updated Casks
Updated 19 casks.
Warning: [email protected] 1.1.1l is already installed and up-to-date.
To reinstall 1.1.1l, run:
brew reinstall [email protected]
DIG139:cfs-web davea$ brew reinstall openssl
==> Downloading https://ghcr.io/v2/homebrew/core/openssl/1.1/manifests/1.1.1l
Already downloaded: /Users/davea/Library/Caches/Homebrew/downloads/7cb540b15662ae88caf307947df0254e5c64c04933630f7e9543cb018107ecbe--openssl@1.1-1.1.1l.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/openssl/1.1/blobs/sha256:ff8b2a965c680b4d9baccd60e799d0989e7dc562d2ba81696
Already downloaded: /Users/davea/Library/Caches/Homebrew/downloads/b6c57e7f9acfe19e13efdfa925e9d77bbc52f6965e0f48326f64f73d18ef9c81--openssl@1.1--1.1.1l.big_sur.bottle.tar.gz
==> Reinstalling [email protected]
==> Pouring [email protected]_sur.bottle.tar.gz
==> Regenerating CA certificate bundle from keychain, this may take a while...
🍺 /usr/local/Cellar/[email protected]/1.1.1l: 8,073 files, 18.5MB
Removing: /usr/local/Cellar/[email protected]/1.1.1k... (8,071 files, 18.5MB)
Removing: /Users/davea/Library/Caches/Homebrew/[email protected]... (5.4MB)
上面似乎暗示我已经安装了1.1.1版本,但是当我检查命令行时,我看到以下内容:
$ openssl version
LibreSSL 2.8.3
$ which openssl
/usr/bin/openssl
这个新版本的 OpenSSL 来自哪里?如何使版本在我的计算机上保持一致?
您可以将类似的内容添加到您的 shell 中,以便您的环境选择brew版本。
export PATH="/usr/local/opt/openssl@1/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/openssl@1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1/include"