Ruby on Rails 警告“Ruby 正在以不安全的方式加载 libcrypto”

Luc*_*ane 5 ruby ruby-on-rails macos-big-sur

当我在终端上运行 Rails 命令(例如创建模型)时,这是我收到的错误:

WARNING: /Users/my_mac_username/.rvm/rubies/ruby-2.5.3/bin/ruby is loading libcrypto in an unsafe way

[1] 5396 abort bin/rails g model ModelName attribute_1:string attribute_2:integer

我的 Mac 正在运行 big sur,

小智 8

我最终使用此线程中的信息解决了相同的问题:https://giters.com/se3000/ruby-eth/issues/47

在 M1 Mac 上,对我来说开箱即用的解决方案是使用以下内容:

sudo ln -s $(brew --prefix openssl)/lib/libcrypto.dylib /usr/local/lib/
sudo ln -s $(brew --prefix openssl)/lib/libssl.dylib  /usr/local/lib
Run Code Online (Sandbox Code Playgroud)

正如@tbraden 指出的那样,这绝对是一个 dylib 问题。

  • 以上工作正常,但请注意您的系统上拥有/需要的 openssl 版本。`brew --prefix openssl` 将返回最新版本 (openssl@3),但是有些人(例如我自己)正在使用 openssl@1.1。在这些情况下,它应该是“$(brew --prefix openssl@1.1)”。 (5认同)

tbr*_*den 1

这只是一个警告而不是致命错误。在 Mac 上,您可以打开该Console程序(Spotlight 搜索Console)并查找 ruby​​ 崩溃日志。

对我来说,这是无效 dylib 加载时的错误,可以通过在此线程https://developer.apple.com/forums/thread/119429之后创建符号链接来解决。