在我的Mac10.15.5版本中,openssl仍然指向LibreSSL 2.8.3。我已经使用了下面的命令,但没有成功
homebrew install libressl安装后,当我运行版本命令时,它仍然显示LibreSSL 2.8.3,下面的命令也抛出错误-
brew link --force openssl
Warning: Refusing to link macOS provided/shadowed software: openssl@1.1
If you need to have openssl@1.1 first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc
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"发布于 2020-06-26 20:58:24
你可能已经让它工作了。要测试运行,请执行以下操作:which openssl
此外,运行以下命令将提示哪个版本是默认版本:openssl version
要更改为自制版本,您需要将其添加到默认版本之前的路径中。为此,编辑shell的启动脚本(在您的示例中似乎是zsh)。因此,在您的情况下,使用您最喜欢的文本编辑器或类似于:nano ~/.zshrc来编辑~/.zshc
(对于默认的bash shell,使用nano ~/.bashrc)
使用以下行插入命令,将路径添加到brew安装的openssl,最好是在文件顶部附近的某个位置:
export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"
(在撰写本文时,openssl的最新版本已经升级到1.1.1,所以现在可能需要这样看export PATH="/usr/local/opt/openssl@1.1.1/bin:$PATH")
然后使用以下命令“重新加载”zsh启动脚本:
source ~/.zshrc
现在,在运行which openssl或openssl version时,您应该会看到OpenSSL1.1(不再是LibreSSL1.1
发布于 2021-03-19 03:52:41
所以对我来说,openssl version曾经是LibreSSL 2.8.3。执行export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"只是为了在终端中显示OpenSSL 1.1.1i,而且which openssl也给了我正确的命令,但它仍然不起作用。
因此,在export PATH="/usr/local/opt/openssl@1.1/bin:$PATH" ~/.profile 内部添加行~/.profile起作用了。
如果您使用的是bash、~/.zshrc或/etc/paths,则不使用~/.bash_profile。
https://stackoverflow.com/questions/62195898
复制相似问题