troubles with RVM and OpenSSL

2020-02-02 11:11发布

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

First I install 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...

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"

ideas?

标签: ruby openssl rvm
9条回答
趁早两清
2楼-- · 2020-02-02 12:01

So this worked for me:

rvm pkg install openssl
rvm reinstall all --force

I also had rvm autolibs rvm_pkg for readline support.

查看更多
放荡不羁爱自由
3楼-- · 2020-02-02 12:02

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

Install Homebrew

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

Don't use rvm pkg it's deprecated, use rvm autolibs enabled.

查看更多
smile是对你的礼貌
4楼-- · 2020-02-02 12:02

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.

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/

tar -xzf openssl-1.0.2t.tar.gz
cd openssl-1.0.2t
./Configure darwin64-x86_64-cc --prefix=/usr/local/opt/openssl@1.0
make
make test
sudo make install

rvm install 2.3.3 --with-openssl-dir=/usr/local/opt/openssl@1.0
ruby -v
ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION'              
>> OpenSSL 1.0.2t  10 Sep 2019
查看更多
登录 后发表回答