ruby RVM 和 OpenSSL 的问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15511943/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-06 05:50:11  来源:igfitidea点击:

troubles with RVM and OpenSSL

rubyopensslrvm

提问by phil swenson

Trying to set up a new macbook for a colleague. Not going well.

试图为同事设置新的 macbook。进展不顺利。

First I install OpenSSL:

首先我安装 OpenSSL:

Heathers-MacBook-Pro:~ heather$ rvm pkg install openssl
Fetching openssl-1.0.1c.tar.gz to /Users/heather/.rvm/archives
######################################################################## 100.0%
Extracting openssl to /Users/heather/.rvm/src/openssl-1.0.1c
Configuring openssl in /Users/heather/.rvm/src/openssl-1.0.1c.
Compiling openssl in /Users/heather/.rvm/src/openssl-1.0.1c.
Installing openssl to /Users/heather/.rvm/usr

Please note that it's required to reinstall all rubies:

    rvm reinstall all --force

Updating openssl certificates

Then I try to install ruby with openssl...

然后我尝试用openssl安装ruby ...

Heathers-MacBook-Pro:website heather$ rvm install 1.9.3 --with-openssl-dir=$HOME/.rvm/usr
Fetching yaml-0.1.4.tar.gz to /Users/heather/.rvm/archives
Extracting yaml to /Users/heather/.rvm/src/yaml-0.1.4
Configuring yaml in /Users/heather/.rvm/src/yaml-0.1.4.
Compiling yaml in /Users/heather/.rvm/src/yaml-0.1.4.
Installing yaml to /Users/heather/.rvm/usr
Installing Ruby from source to: /Users/heather/.rvm/rubies/ruby-1.9.3-p392, this may take a while depending on your cpu(s)...
ruby-1.9.3-p392 - #downloading ruby-1.9.3-p392, this may take a while depending on your connection...
ruby-1.9.3-p392 - #extracting ruby-1.9.3-p392 to /Users/heather/.rvm/src/ruby-1.9.3-p392
ruby-1.9.3-p392 - #extracted to /Users/heather/.rvm/src/ruby-1.9.3-p392
ruby-1.9.3-p392 - #configuring
ruby-1.9.3-p392 - #compiling
ruby-1.9.3-p392 - #installing 
Removing old Rubygems files...
Installing rubygems-1.8.25 for ruby-1.9.3-p392 ...
Installation of rubygems completed successfully.
Saving wrappers to '/Users/heather/.rvm/bin'.
ruby-1.9.3-p392 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ruby-1.9.3-p392 - #importing default gemsets, this may take time ...
Install of ruby-1.9.3-p392 - #complete 

Heathers-MacBook-Pro:website heather$ bundle update
Could not load OpenSSL.
You must recompile Ruby with OpenSSL support or change the sources in your Gemfile from 'https' to 'http'. Instructions for
compiling with OpenSSL using RVM are available at rvm.io/packages/openssl.

btw, the gem file says "source https://rubygems.org"

顺便说一句,gem 文件说“源https://rubygems.org

ideas?

想法?

采纳答案by fmendez

Try this:

尝试这个:

rvm get head
rvm pkg remove
rvm requirements run  # if brew gives you warnings about formulas to install, run "brew install" for each before moving on.

rvm reinstall [the version you need (i.e: 2.0.0)]

回答by phq

OP actually saved my day! In my case:

OP实际上拯救了我的一天!就我而言:

$ rvm pkg install openssl
$ rvm remove 2.4
$ rvm install 2.4 --with-openssl-dir=$HOME/.rvm/usr
$ gem install bundler

回答by noraj

It's well described on ArchLinux wiki:

它在ArchLinux wiki上有很好的描述:

Ruby versions older than 2.4 require OpenSSL 1.0 but RVM will try to build them with OpenSSL 1.1.

Ruby 2.4 之前的版本需要 OpenSSL 1.0,但 RVM 将尝试使用 OpenSSL 1.1 构建它们。

So you can do (easiest):

所以你可以做(​​最简单的):

$ rvm pkg install openssl
$ rvm reinstall 2.3.5 --with-openssl-dir=$HOME/.rvm/usr

You can see more solutions on ArchLinux wiki.

您可以在ArchLinux wiki上查看更多解决方案。

回答by guapolo

Installing Ruby 2.2 on macOS Mojave (10.14.2) with Homebrew.

使用 Homebrew 在 macOS Mojave (10.14.2) 上安装 Ruby 2.2。

Install Homebrew

安装 Homebrew

brew install openssl
rvm install 2.2 --with-openssl-dir=/usr/local/opt/openssl

Don't use rvm pkgit's deprecated, use rvm autolibs enabled.

不要使用rvm pkg已弃用,使用rvm autolibs enabled.

回答by Chris Hobbs

Here's how I installed rvm and ruby 2.3 on a mac with Catalina. The version of rvm installed was 1.29.9. OpenSSL 1.0.2 (downgrade) had to be installed. Note the "ipv4" in the gpg command.

这是我如何在带有 Catalina 的 Mac 上安装 rvm 和 ruby​​ 2.3。安装的 rvm 版本是 1.29.9。必须安装 OpenSSL 1.0.2(降级)。请注意 gpg 命令中的“ipv4”。

gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
\curl -sSL https://get.rvm.io | bash -s stable

Download openssl 1.0.2 at https://www.openssl.org/source/

https://www.openssl.org/source/下载 openssl 1.0.2

tar -xzf openssl-1.0.2t.tar.gz
cd openssl-1.0.2t
./Configure darwin64-x86_64-cc --prefix=/usr/local/opt/[email protected]
make
make test
sudo make install

rvm install 2.3.3 --with-openssl-dir=/usr/local/opt/[email protected]
ruby -v
ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION'              
>> OpenSSL 1.0.2t  10 Sep 2019

回答by zhongxiao37

For those who have issue with openssl 1.1 and Ruby 2.3 via RVM on Mac Mojave, you could try following commands. The problem is Ruby 2.3 is not compatible with openssl 1.1

对于那些在 Mac Mojave 上通过 RVM 使用 openssl 1.1 和 Ruby 2.3 的人,您可以尝试以下命令。问题是 Ruby 2.3 与 openssl 1.1 不兼容

rvm pkg install openssl
PKG_CONFIG_PATH=$HOME/.rvm/usr/lib/pkgconfig rvm reinstall 2.3.3 --with-openssl-dir=$HOME/.rvm/usr

回答by blazejmar

On MacOS 10.12.2 installing openssl via brew, won't work. To fix it, run:

在 MacOS 10.12.2 上通过 brew 安装 openssl,将不起作用。要修复它,请运行:

export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig:/usr/local/lib/pkgconfig

And then install Ruby via rvm.

然后通过 rvm 安装 Ruby。

EDIT: More information about the reason behind the problem here.

编辑:有关此处问题背后原因的更多信息。

回答by Dorian

So this worked for me:

所以这对我有用:

rvm pkg install openssl
rvm reinstall all --force

I also had rvm autolibs rvm_pkgfor readline support.

我也有rvm autolibs rvm_pkgreadline 支持。

回答by ruslan

openssl version: 1.0.2k

openssl 版本:1.0.2k

This worked for me:

这对我有用:

brew reinstall openssl

回答by Yurii Verbytskyi

For older version of ruby 2.2.10on MacOS High Sierra 10.13.6the only thing worked for me was:

对于旧版本的 ruby 2.2.10MacOS High Sierra 10.13.6唯一对我有用的是:

  1. switching to older OpenSSL version
  1. 切换到较旧的 OpenSSL 版本
brew switch openssl 1.0.2s
  1. Than reinstalling ruby using --with-openssl-dir
  1. 比使用重新安装 ruby --with-openssl-dir
rvm reinstall 2.2.10 --with-openssl-dir=/usr/local/Cellar/openssl/1.0.2s