ruby-on-rails - Brew 更新中断 openssl

标签 ruby-on-rails openssl homebrew rvm

今天我想通过 RVM 安装一个新的 Ruby 版本,并且触发了一个破坏 OpenSSL 的 Homebrew 程序更新。

[~]$ rvm install 2.7
.
.
.
No binary rubies available for: osx/10.14/x86_64/ruby-2.7.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Updating Homebrew...
==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics

==> Auto-updated Homebrew!
Updated Homebrew from 1ea1f31d0 to c0b916764.
Updated 3 taps (homebrew/core, homebrew/cask and homebrew/services).
.
.
.
==> Upgrading 4 outdated packages:
coreutils 8.30_2 -> 8.31
libyaml 0.2.1 -> 0.2.2
openssl@1.1 1.1.1a -> 1.1.1d
readline 8.0.0 -> 8.0.1
==> Upgrading openssl@1.1 
==> Downloading https://homebrew.bintray.com/bottles/openssl@1.1-1.1.1d.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/10/104ef018b7bb8fcc49f57e5a60359a28a02d480d85a959e6141394b0571cbb28?__gda__=exp=1578044774~hmac=a692626c1c5fbcfeb1077551a60292afc273163879d04dc708c6051d0fc02d5a&response-content-disposition=attachment%3Bfilename%3D%22openssl%401.1
######################################################################## 100.0%
==> Pouring openssl@1.1-1.1.1d.mojave.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@1.1/certs

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

openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,
because openssl/libressl is provided by macOS so don't link an incompatible version.

If you need to have openssl@1.1 first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.bash_profile

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"

For pkg-config to find openssl@1.1 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"

==> Summary
🍺  /usr/local/Cellar/openssl@1.1/1.1.1d: 7,983 files, 17.9MB
==> `brew cleanup` has not been run in 30 days, running now...
Removing: /usr/local/Cellar/openssl@1.1/1.1.1a... (7,953 files, 17.9MB)
Removing: /Users/MyAccount/Library/Logs/Homebrew/libdvdcss... (64B)
Pruned 0 symbolic links and 2 directories from /usr/local
当我尝试运行 RAILS 时,我收到一个 openssl connected 错误:
[~]$ rails s
/Users/MyAccount/.rvm/rubies/ruby-x/lib/ruby/x/..../openssl.bundle: dlopen(/Users/MyAccount/.rvm/rubies/ruby-x/lib/ruby/x/..../openssl.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib (LoadError)
  Referenced from: /Users/MyAccount/.rvm/rubies/ruby-x/lib/ruby/x/..../openssl.bundle/openssl.bundle
  Reason: image not found - /Users/MyAccount/.rvm/rubies/ruby-x/lib/ruby/x/..../openssl.bundle/openssl.bundle
brew info openssl给我:
[~]$ brew info openssl
openssl@1.1: stable 1.1.1d (bottled) [keg-only]
Cryptography and SSL/TLS Toolkit
https://openssl.org/
/usr/local/Cellar/openssl@1.1/1.1.1a (7,953 files, 17.9MB)
  Poured from bottle on 2019-02-11 at 09:38:06
/usr/local/Cellar/openssl@1.1/1.1.1d (7,983 files, 17.9MB)
  Poured from bottle on 2020-01-03 at 15:15:16
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/openssl@1.1.rb
==> 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@1.1/certs

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

openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,
because openssl/libressl is provided by macOS so don't link an incompatible version.

If you need to have openssl@1.1 first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.bash_profile

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"

For pkg-config to find openssl@1.1 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"
不知何故,我在 brew 中安装了两个 openssl 公式:openssl 和 openssl@1.1。其中 openssl 的版本为 1.0.2q,而 openssl@1.1 的版本为 1.1.1a 和 1.1.1d。
在我的 .bash_profile 中,我配置了路径:
### Customize path for openssl
export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"
不知何故,我无法使用 openssl 的升级版本:无法更新 RVM,重新安装 ruby​​,运行 rails。我能够让它工作的唯一方法是删除
/usr/local/Cellar/openssl@1.1/1.1.1d 
并复制
/usr/local/Cellar/openssl/1.0.2q 
里面。
我怎样才能让它以正确的方式运行?
先感谢您!!!

最佳答案

感谢 brew.sh 上的讨论页面的帮助,我能够找到问题的原因。

brew 及其公式的自动更新不仅覆盖了 openssl@1.1 的符号链接(symbolic link),而且覆盖了 /usr/local/opt 中的通用 openssl 链接。 .现在两者都指向/usr/local/Cellar/openssl@1.1 ,而在我的第二个开发系统上,openssl 符号链接(symbolic link)仍然指向 /usr/local/Cellar/openssl .

在我为 /usr/local/Cellar/openssl 重新创建 openssl 符号链接(symbolic link)之后一切都恢复正常。

上下文是 openssl 1.1 是最安全的版本,而据我所知 1.0 已被弃用。但在我的情况下,它只是为了维护一个正在开发的遗留项目。

现在,在每次 brew 更新/升级之后,我还有一件事要做:验证符号链接(symbolic link),在最近引入自动清除旧版本之后已经迫使我将它们从备份复制回我的系统。

关于ruby-on-rails - Brew 更新中断 openssl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59583075/

相关文章:

openssl - 通过 openSSL API 加载从 java 生成的公钥

ssl - 这些PEM文件(包括链)如何转换为KEY和CRT文件?

macos - 如何在 OSX 上安装特定的 clang 版本?

homebrew - Mac OSX Mountain Lion 的错误 : Cowardly refusing to `sudo brew install` for installing glue 0. 3

javascript - 如何重新呈现文本字段的 javascript onchange?

ruby-on-rails - 找不到 compass 插件 Susy

windows - Android 库链接和 LOCAL_SRC_FILES 指向丢失的文件

使用brew安装的docker在/var/run/docker.sock上失败

ruby-on-rails - Rails 控制台中有没有办法打印数据库目录?

ruby-on-rails - 如何使用 Rails Ransack 过滤 boolean 属性?