如何安装最新版本的openssl Mac OS X El Capitan

时间:2016-02-01 11:58:35

标签: macos openssl homebrew

我已经使用brew install openssl下载并安装了openssl v1.0.2f,但是,它回来说:

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

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

This formula is keg-only, which means it was not symlinked into /usr/local.

Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/openssl/lib
    CPPFLAGS: -I/usr/local/opt/openssl/include

当我做openssl version -a它总是给我:

OpenSSL 0.9.8zg 14 July 2015
built on: Jul 31 2015
platform: darwin64-x86_64-llvm
options:  bn(64,64) md2(int) rc4(ptr,char) des(idx,cisc,16,int) blowfish(idx) 
compiler: -arch x86_64 -fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -O3 -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DL_ENDIAN -DMD32_REG_T=int -DOPENSSL_NO_IDEA -DOPENSSL_PIC -DOPENSSL_THREADS -DZLIB -mmacosx-version-min=10.6
OPENSSLDIR: "/System/Library/OpenSSL"

如何用新版本替换旧版本?我已经搜索了很多关于如何做到这一点,但在线解决方案似乎对我不起作用......

9 个答案:

答案 0 :(得分:25)

只有

export PATH=$(brew --prefix openssl)/bin:$PATH in ~/.bash_profile

对我有用! 谢谢mipadi。

答案 1 :(得分:23)

执行以下命令:

brew update
brew install openssl
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile

您将安装最新版本的openssl,并可从cli(命令行/终端)访问。由于第三个命令会将导出路径添加到.bash_profile,因此可以在系统重新启动时访问新安装的openssl版本。

答案 2 :(得分:6)

尝试创建符号链接,确保首先在<button onclick="somefunction()">BUTTON 1</button> <button onclick="anothfunction()">BUTTON 2</button>中安装了openssl。

/usr/local/include

Openssl with El Capitan的更多信息。

答案 3 :(得分:2)

当我搜索有关openssl仅限keg的信息时,我到达了此页面。我相信我已经理解了Homebrew现在采取这一行动的原因。我的解决方案可能适合您:

  • 使用以下命令使新的openssl命令可用(假设您已调整PATH以将/ usr / local / bin放在/ usr / bin之前): ln -s /usr/local/opt/openssl/bin/openssl /usr/local/bin/

  • 使用openssl进行编译时,请遵循Homebrew的建议并使用 -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib

  • 或者,您可以通过在.bash_profile或.bashrc中添加以下行来永久保留这些设置: export CPATH=/usr/local/opt/openssl/include export LIBRARY_PATH=/usr/local/opt/openssl/lib

答案 4 :(得分:1)

我无法重现您运行El Cap + Homebrew 1.0.x的问题

升级到9月底发布的Homebrew 1.0.x. Specific changes were made in the way openssl is linked。该项目的发布时间表更加稳健,现已达到1.0。

brew uninstall openssl
brew update && brew upgrade && brew cleanup && brew doctor

在继续之前,您应该修复brew doctor引发的任何问题。

brew install openssl

注意: 升级自制程序会将所有已安装的软件包更新为最新版本。

答案 5 :(得分:1)

这是一个古老的问题,但由于许多上述答案现在可能无法解决,因此仍在当今的情况下进行回答。

问题在于路径仍指向旧版本。可以提供两种解决方案:

  1. 卸载旧版本的openssl软件包brew uninstall openssl,然后重新安装新版本:brew install openssl
  2. 将PATH指向openssl的新版本。首先安装新版本,现在(如果已安装)最新版本,请指向该路径:echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

答案 6 :(得分:1)

此命令解决了我在github CI作业和virtualbox上的问题

brew install openssl@1.1
cp /usr/local/opt/openssl@1.1/lib/pkgconfig/*.pc /usr/local/lib/pkgconfig/

答案 7 :(得分:-1)

如果您不介意警告消息中突出显示的潜在问题,您可以运行/usr/local将其链接到export PATH=$(brew --prefix openssl)/bin:$PATH 。否则,您可以将openssl bin目录添加到路径中:

ORDER BY

答案 8 :(得分:-1)

要用旧版本替换旧版本,您需要更改它的链接。输入该命令到终端。

brew link --force openssl

再次检查openssl的版本。它应该改变。