自制软件拒绝 link OpenSSL
Homebrew refusing to link OpenSSL
我在:OSX 10.11.6,Homebrew 版本 0.9.9m OpenSSL 0.9.8zg 2015 年 7 月 14 日
我正在尝试使用 dotnetcore 并关注他们的 instructions、
我已经 upgraded/installed 最新版本的 openssl:
> brew install openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2h_1.el_capitan.bottle.tar.gz
Already downloaded: /Users/administrator/Library/Caches/Homebrew/openssl-1.0.2h_1.el_capitan.bottle.tar.gz
==> Pouring openssl-1.0.2h_1.el_capitan.bottle.tar.gz
==> Caveats
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
但是当我尝试 link openssl 时,我继续 运行 进入这个 linking 错误:
> brew link --force openssl
Warning: Refusing to link: openssl
Linking keg-only OpenSSL means you may end up linking against the insecure,
deprecated system version while using the headers from the Homebrew version.
Instead, pass the full include/library paths to your compiler e.g.:
-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib
包含编译器标志的选项对我来说没有意义,因为我没有编译我所依赖的这些库。
编辑 dotnetcore 更新了他们的说明:
brew update
brew install openssl
ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/
注意:由于https://github.com/Homebrew/brew/pull/612
,这不再有效
我今天遇到了同样的问题。我卸载了(未酿造的??)openssl 1.0.2 并安装了 1.0.1 也与自制软件。 Dotnet new/restore/run 然后工作正常。
安装 openssl 101:
酿造安装 homebrew/versions/openssl101
链接:
brew link --force homebrew/versions/openssl101
正如其他答案的更新所暗示的那样,安装旧的 openssl101 brew 的解决方法将不再有效。有关即时解决方法,请参阅 this comment on dotnet/cli#3964.
将问题最相关的部分复制到此处:
I looked into the other option that was suggested for setting the rpath on the library. I think the following is a better solution that will only effect this specific library.
sudo install_name_tool -add_rpath /usr/local/opt/openssl/lib /usr/local/share/dotnet/shared/Microsoft.NETCore.App/1.0.0/System.Security.Cryptography.Native.dylib
and/or if you have NETCore 1.0.1 installed perform the same command for 1.0.1 as well:
sudo install_name_tool -add_rpath /usr/local/opt/openssl/lib /usr/local/share/dotnet/shared/Microsoft.NETCore.App/1.0.1/System.Security.Cryptography.Native.dylib
In effect, rather than telling the operating system to always use the homebrew version of SSL and potentially causing something to break, we're telling dotnet how to find the correct library.
同样重要的是,看起来 Microsoft 已经意识到了这个问题,并且有 a) 一个稍微直接的缓解计划以及 b) 一个长期解决方案(可能将 OpenSSL 与 dotnet 捆绑在一起)。
另一件需要注意的事情:/usr/local/opt/openssl/lib
是 brew 默认 linked 的地方:
13:22 $ ls -l /usr/local/opt/openssl
lrwxr-xr-x 1 ben admin 26 May 15 14:22 /usr/local/opt/openssl -> ../Cellar/openssl/1.0.2h_1
如果出于某种原因您安装了 brew 并且 link 它在不同的位置,那么该路径就是您应该用作 rpath 的路径。
更新 System.Security.Cryptography.Native.dylib 库的 rpath 后,您需要重新启动交互式会话(即关闭控制台并启动另一个)。
None 这些解决方案适用于 OS X El Capitan 10.11.6。可能是因为 OS X 有一个它认为更好的本地版本的 openssl,因此不喜欢篡改。
所以,我走上了正轨,重新开始......
手动安装和符号链接
cd /usr/local/src
如果您收到“没有这样的文件或目录”,请将其设为:
cd /usr/local && mkdir src && cd src
下载 openssl:
curl --remote-name https://www.openssl.org/source/openssl-1.0.2h.tar.gz
提取并 cd 到:
tar -xzvf openssl-1.0.2h.tar.gz
cd openssl-1.0.2h
编译安装:
./configure darwin64-x86_64-cc --prefix=/usr/local/openssl-1.0.2h shared
make depend
make
make install
现在符号链接 OS X 的 openssl 到您新的和更新的 openssl:
ln -s /usr/local/openssl-1.0.2h/bin/openssl /usr/local/bin/openssl
关闭终端,打开一个新会话,并验证 OS X 正在使用您的新 openssl:
openssl version -a
在尝试了所有我能找到的方法但没有任何效果之后,我尝试了这个:
touch ~/.bash_profile; open ~/.bash_profile
在文件中添加了这一行。
export PATH="$PATH:/usr/local/Cellar/openssl/1.0.2j/bin/openssl"
现在可以了:)
Jorns-iMac:~ jorn$ openssl version -a
OpenSSL 1.0.2j 26 Sep 2016
built on: reproducible build, date unspecified
//blah blah
OPENSSLDIR: "/usr/local/etc/openssl"
Jorns-iMac:~ jorn$ which openssl
/usr/local/opt/openssl/bin/openssl
这对我有用:
brew update
brew install openssl
ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/
ln -s /usr/local/Cellar/openssl/1.0.2j/bin/openssl /usr/local/bin/openssl
感谢@dorlandode 在这个线程上 https://github.com/Homebrew/brew/pull/597
注意:在我可以花时间从头开始正确安装 Openssl 之前,我只是将其用作临时修复。正如我所记得的那样,在我意识到最好的方法是逐一手动安装我需要的证书之前,我花了一天中最好的时间来调试和遇到问题。请在尝试之前阅读@bouke 评论中的link。
我也有类似的情况。我需要通过 brew 安装 openssl,然后使用 pip 安装 mitmproxy。我从 brew link --force
那里得到了同样的抱怨。以下是我达到的解决方案:(无力 link by brew)
LDFLAGS=-L/usr/local/opt/openssl/lib
CPPFLAGS=-I/usr/local/opt/openssl/include
PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig
pip install mitmproxy
这并没有直接解决问题。我留下了一行,以防有人使用 pip 并需要 openssl 库。
注意:/usr/local/opt/openssl/lib
路径是通过brew info openssl
获取的
只需执行 brew info openssl
并阅读其中显示的信息:
If you need to have this software first in your PATH run: echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
这对我有用:
brew install openssl
cd /usr/local/include
ln -s ../opt/openssl/include/openssl .
上面来自 edwardthesecond 的解决方案在 Sierra 上也对我有用
brew install openssl
cd /usr/local/include
ln -s ../opt/openssl/include/openssl
./configure && make
我之前执行的其他步骤是:
正在通过 brew 安装 openssl
brew install openssl
按照 homebrew 的建议将 openssl 添加到路径中
brew info openssl
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
如果迁移您的 mac 会破坏自制程序:
我迁移了我的 mac,它取消了 所有 我的自制程序安装的链接 - 包括 OpenSSL。这破坏了 gem install
,这是我第一次注意到这个问题并开始尝试修复它的方式。
经过一百万个解决方案(当迁移到 OSX Sierra - 10.12.5 时),解决方案变得非常简单:
brew reinstall ruby
brew reinstall openssl
稍后编辑:正如 Gal Bracha 在评论中指出的那样,您?可能?为了安全起见,需要在重新安装之前删除 /usr/local/opt/openssl
。当时我不需要这样做,但如果您仍然遇到问题,请尝试一下。
对我来说这是有效的...
我编辑了 ./bash_profile 并添加了下面的命令
导出 PATH="/usr/local/opt/openssl/bin:$PATH"
我在尝试安装较新版本的 ruby 2.6.5 时遇到了同样的问题
https://github.com/kelaberetiv/TagUI/issues/86 帮我解决了问题。如果适用于 macOS catalina 版本 10.15.1
基本上,我做了 update and upgrade
自制软件并安装了 openssl 并安装了 ruby。
brew update && brew upgrade
brew install openssl
然后创建这 2 个符号链接
ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/
然后安装ruby 2.6.5
export https_proxy=http://127.0.0.1:1087 http_proxy=http://127.0.0.1:1087 all_proxy=socks5://127.0.0.1:1080
适合我
而且我认为它可以解决所有问题
Failed to connect to raw.githubusercontent.com port 443: Connection refused
默认情况下,自制软件为我提供了 OpenSSL 1.1 版,而我正在寻找 1.0 版。这对我有用。
要安装 1.0 版:
brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb
然后我尝试通过它进行符号链接,但它给了我以下错误:
ln -s /usr/local/Cellar/openssl/1.0.2t/include/openssl /usr/bin/openssl
ln: /usr/bin/openssl: Operation not permitted
最终使用 brew switch 命令链接 openssl 以指向 1.0 版本:
brew switch openssl 1.0.2t
Cleaning /usr/local/Cellar/openssl/1.0.2t
Opt link created for /usr/local/Cellar/openssl/1.0.2t
解决方案可能是更新一些工具。
这是我在 Ruby 和 Python 的 2020 年的情景:
我需要在 Mac 上安装 Python 3,然后事情升级了。最后更新homebrew、node和python导致openssl出现问题。我没有 openssl 1.0 了,所以我不能“brew switch”到它。
那么什么还在尝试使用那个旧的 1.0 版本?
原来是Ruby2.5.5.
所以我只是 安装了 Ruby 2.5.8 并删除了旧版本。
如果这还不够,您可以尝试其他方法:使用 rbenv 和 pyenv。清理宝石和公式。更新自制软件、节点、纱线。升级捆绑器。确保您的 .bash_profile(或等效项)是根据每个工具的说明设置的。重新打开终端。
我在:OSX 10.11.6,Homebrew 版本 0.9.9m OpenSSL 0.9.8zg 2015 年 7 月 14 日
我正在尝试使用 dotnetcore 并关注他们的 instructions、
我已经 upgraded/installed 最新版本的 openssl:
> brew install openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2h_1.el_capitan.bottle.tar.gz
Already downloaded: /Users/administrator/Library/Caches/Homebrew/openssl-1.0.2h_1.el_capitan.bottle.tar.gz
==> Pouring openssl-1.0.2h_1.el_capitan.bottle.tar.gz
==> Caveats
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
但是当我尝试 link openssl 时,我继续 运行 进入这个 linking 错误:
> brew link --force openssl
Warning: Refusing to link: openssl
Linking keg-only OpenSSL means you may end up linking against the insecure,
deprecated system version while using the headers from the Homebrew version.
Instead, pass the full include/library paths to your compiler e.g.:
-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib
包含编译器标志的选项对我来说没有意义,因为我没有编译我所依赖的这些库。
编辑 dotnetcore 更新了他们的说明:
brew update
brew install openssl
ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/
注意:由于https://github.com/Homebrew/brew/pull/612
,这不再有效我今天遇到了同样的问题。我卸载了(未酿造的??)openssl 1.0.2 并安装了 1.0.1 也与自制软件。 Dotnet new/restore/run 然后工作正常。
安装 openssl 101:
酿造安装 homebrew/versions/openssl101
链接:
brew link --force homebrew/versions/openssl101
正如其他答案的更新所暗示的那样,安装旧的 openssl101 brew 的解决方法将不再有效。有关即时解决方法,请参阅 this comment on dotnet/cli#3964.
将问题最相关的部分复制到此处:
I looked into the other option that was suggested for setting the rpath on the library. I think the following is a better solution that will only effect this specific library.
sudo install_name_tool -add_rpath /usr/local/opt/openssl/lib /usr/local/share/dotnet/shared/Microsoft.NETCore.App/1.0.0/System.Security.Cryptography.Native.dylib
and/or if you have NETCore 1.0.1 installed perform the same command for 1.0.1 as well:
sudo install_name_tool -add_rpath /usr/local/opt/openssl/lib /usr/local/share/dotnet/shared/Microsoft.NETCore.App/1.0.1/System.Security.Cryptography.Native.dylib
In effect, rather than telling the operating system to always use the homebrew version of SSL and potentially causing something to break, we're telling dotnet how to find the correct library.
同样重要的是,看起来 Microsoft 已经意识到了这个问题,并且有 a) 一个稍微直接的缓解计划以及 b) 一个长期解决方案(可能将 OpenSSL 与 dotnet 捆绑在一起)。
另一件需要注意的事情:/usr/local/opt/openssl/lib
是 brew 默认 linked 的地方:
13:22 $ ls -l /usr/local/opt/openssl
lrwxr-xr-x 1 ben admin 26 May 15 14:22 /usr/local/opt/openssl -> ../Cellar/openssl/1.0.2h_1
如果出于某种原因您安装了 brew 并且 link 它在不同的位置,那么该路径就是您应该用作 rpath 的路径。
更新 System.Security.Cryptography.Native.dylib 库的 rpath 后,您需要重新启动交互式会话(即关闭控制台并启动另一个)。
None 这些解决方案适用于 OS X El Capitan 10.11.6。可能是因为 OS X 有一个它认为更好的本地版本的 openssl,因此不喜欢篡改。
所以,我走上了正轨,重新开始......
手动安装和符号链接
cd /usr/local/src
如果您收到“没有这样的文件或目录”,请将其设为:
cd /usr/local && mkdir src && cd src
下载 openssl:
curl --remote-name https://www.openssl.org/source/openssl-1.0.2h.tar.gz
提取并 cd 到:
tar -xzvf openssl-1.0.2h.tar.gz
cd openssl-1.0.2h
编译安装:
./configure darwin64-x86_64-cc --prefix=/usr/local/openssl-1.0.2h shared
make depend
make
make install
现在符号链接 OS X 的 openssl 到您新的和更新的 openssl:
ln -s /usr/local/openssl-1.0.2h/bin/openssl /usr/local/bin/openssl
关闭终端,打开一个新会话,并验证 OS X 正在使用您的新 openssl:
openssl version -a
在尝试了所有我能找到的方法但没有任何效果之后,我尝试了这个:
touch ~/.bash_profile; open ~/.bash_profile
在文件中添加了这一行。
export PATH="$PATH:/usr/local/Cellar/openssl/1.0.2j/bin/openssl"
现在可以了:)
Jorns-iMac:~ jorn$ openssl version -a
OpenSSL 1.0.2j 26 Sep 2016
built on: reproducible build, date unspecified
//blah blah
OPENSSLDIR: "/usr/local/etc/openssl"
Jorns-iMac:~ jorn$ which openssl
/usr/local/opt/openssl/bin/openssl
这对我有用:
brew update
brew install openssl
ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/
ln -s /usr/local/Cellar/openssl/1.0.2j/bin/openssl /usr/local/bin/openssl
感谢@dorlandode 在这个线程上 https://github.com/Homebrew/brew/pull/597
注意:在我可以花时间从头开始正确安装 Openssl 之前,我只是将其用作临时修复。正如我所记得的那样,在我意识到最好的方法是逐一手动安装我需要的证书之前,我花了一天中最好的时间来调试和遇到问题。请在尝试之前阅读@bouke 评论中的link。
我也有类似的情况。我需要通过 brew 安装 openssl,然后使用 pip 安装 mitmproxy。我从 brew link --force
那里得到了同样的抱怨。以下是我达到的解决方案:(无力 link by brew)
LDFLAGS=-L/usr/local/opt/openssl/lib
CPPFLAGS=-I/usr/local/opt/openssl/include
PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig
pip install mitmproxy
这并没有直接解决问题。我留下了一行,以防有人使用 pip 并需要 openssl 库。
注意:/usr/local/opt/openssl/lib
路径是通过brew info openssl
只需执行 brew info openssl
并阅读其中显示的信息:
If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
这对我有用:
brew install openssl
cd /usr/local/include
ln -s ../opt/openssl/include/openssl .
上面来自 edwardthesecond 的解决方案在 Sierra 上也对我有用
brew install openssl
cd /usr/local/include
ln -s ../opt/openssl/include/openssl
./configure && make
我之前执行的其他步骤是:
正在通过 brew 安装 openssl
brew install openssl
按照 homebrew 的建议将 openssl 添加到路径中
brew info openssl echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
如果迁移您的 mac 会破坏自制程序:
我迁移了我的 mac,它取消了 所有 我的自制程序安装的链接 - 包括 OpenSSL。这破坏了 gem install
,这是我第一次注意到这个问题并开始尝试修复它的方式。
经过一百万个解决方案(当迁移到 OSX Sierra - 10.12.5 时),解决方案变得非常简单:
brew reinstall ruby
brew reinstall openssl
稍后编辑:正如 Gal Bracha 在评论中指出的那样,您?可能?为了安全起见,需要在重新安装之前删除 /usr/local/opt/openssl
。当时我不需要这样做,但如果您仍然遇到问题,请尝试一下。
对我来说这是有效的...
我编辑了 ./bash_profile 并添加了下面的命令
导出 PATH="/usr/local/opt/openssl/bin:$PATH"
我在尝试安装较新版本的 ruby 2.6.5 时遇到了同样的问题 https://github.com/kelaberetiv/TagUI/issues/86 帮我解决了问题。如果适用于 macOS catalina 版本 10.15.1
基本上,我做了 update and upgrade
自制软件并安装了 openssl 并安装了 ruby。
brew update && brew upgrade
brew install openssl
然后创建这 2 个符号链接
ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/
然后安装ruby 2.6.5
export https_proxy=http://127.0.0.1:1087 http_proxy=http://127.0.0.1:1087 all_proxy=socks5://127.0.0.1:1080
适合我
而且我认为它可以解决所有问题
Failed to connect to raw.githubusercontent.com port 443: Connection refused
默认情况下,自制软件为我提供了 OpenSSL 1.1 版,而我正在寻找 1.0 版。这对我有用。
要安装 1.0 版:
brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb
然后我尝试通过它进行符号链接,但它给了我以下错误:
ln -s /usr/local/Cellar/openssl/1.0.2t/include/openssl /usr/bin/openssl
ln: /usr/bin/openssl: Operation not permitted
最终使用 brew switch 命令链接 openssl 以指向 1.0 版本:
brew switch openssl 1.0.2t
Cleaning /usr/local/Cellar/openssl/1.0.2t
Opt link created for /usr/local/Cellar/openssl/1.0.2t
解决方案可能是更新一些工具。
这是我在 Ruby 和 Python 的 2020 年的情景:
我需要在 Mac 上安装 Python 3,然后事情升级了。最后更新homebrew、node和python导致openssl出现问题。我没有 openssl 1.0 了,所以我不能“brew switch”到它。
那么什么还在尝试使用那个旧的 1.0 版本?
原来是Ruby2.5.5.
所以我只是 安装了 Ruby 2.5.8 并删除了旧版本。
如果这还不够,您可以尝试其他方法:使用 rbenv 和 pyenv。清理宝石和公式。更新自制软件、节点、纱线。升级捆绑器。确保您的 .bash_profile(或等效项)是根据每个工具的说明设置的。重新打开终端。