错误:执行 gem 时...(Gem::Exception)OpenSSL 不可用

问题描述 投票:0回答:1

尽管我通过

brew install openssl
安装了 openSSL,但在尝试安装/更新任何 gem 时,我收到此 openssl 错误。

这可能会令人沮丧,但有一种方法可以解决这个问题。

ruby-on-rails ruby macos openssl
1个回答
3
投票

要解决这个问题,您需要:

  1. 安装openssl:
    brew install openssl
  2. 使用您用于 ruby 的任何包管理器(rbenv、rvm、frum),重新安装您需要使用的 ruby 版本,使用 cli 选项指定要安装的 ruby 版本要使用的 openssl 目录。

对于 RVM 这意味着:

rvm reinstall 2.3.0 --with-openssl-dir=`brew —-prefix openssl`

对于弗鲁姆:

frum uninstall <ruby version>
frum install <ruby version> --with-openssl-dir=<ssl_dir> # Specify the OpenSSL directory

本指南适用于 MacOS。同样,您应该在您使用的任何操作系统上使用正确的 cli 选项重新安装 ruby。

© www.soinside.com 2019 - 2024. All rights reserved.