Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby 2.3.7 fails to install on macOS Mojave #4781

Open
koppen opened this issue Sep 13, 2019 · 16 comments · May be fixed by #4823
Open

Ruby 2.3.7 fails to install on macOS Mojave #4781

koppen opened this issue Sep 13, 2019 · 16 comments · May be fixed by #4823

Comments

@koppen
Copy link

koppen commented Sep 13, 2019

Description

I am trying to install Ruby 2.3.7 on macOS Mojave but I am getting compilation errors and ultimately the installation is halted.

Looking at the many other issues around these versions it seems likely I am hitting issues with OpenSSL 1.1 and Ruby 2.3 being incompatible with each other. But I've been banging my head against this issue for way too long now, so I figured I might as well flag it here.

Steps to reproduce

  1. rvm get master
  2. rvm install 2.3.7

Expected behavior

  • Ruby 2.3.7 installs without problems, with OpenSSL support, and is ready to be used. Just like when I install Ruby 2.4 or 2.6.

Actual behavior

$ rvm install 2.3.7
Warning, new version of rvm available '1.29.9', you are using older version '1.29.9-next'.
You can disable this warning with:   echo rvm_autoupdate_flag=0 >> ~/.rvmrc
You can enable auto-update with:     echo rvm_autoupdate_flag=2 >> ~/.rvmrc
You can update manually with:        rvm get VERSION                         (e.g. 'rvm get stable')

Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.14/x86_64/ruby-2.3.7.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates bundle '/opt/local/etc/openssl/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/jakob/.rvm/rubies/ruby-2.3.7, this may take a while depending on your cpu(s)...
ruby-2.3.7 - #downloading ruby-2.3.7, this may take a while depending on your connection...
ruby-2.3.7 - #extracting ruby-2.3.7 to /Users/jakob/.rvm/src/ruby-2.3.7 - please wait
ruby-2.3.7 - #configuring - please wait
ruby-2.3.7 - #post-configuration - please wait
ruby-2.3.7 - #compiling - please wait
Error running '__rvm_make -j8',
please read /Users/jakob/.rvm/log/1568363003_ruby-2.3.7/make.log

There has been an error while running make. Halting the installation.

Debug mode:

Environment info

ruby-2.6.0:

  system:
    uname:        "Darwin freshness.local 18.7.0 Darwin Kernel Version 18.7.0: Tue Aug 20 16:57:14 PDT 2019; root:xnu-4903.271.2~2/RELEASE_X86_64 x86_64"
    name:         "OSX"
    version:      "10.14"
    architecture: "x86_64"
    bash:         "/opt/local/bin/bash => GNU bash, version 5.0.7(1)-release (x86_64-apple-darwin18.5.0)"
    zsh:          "/opt/local/bin/zsh => zsh 5.7.1 (x86_64-apple-darwin18.2.0)"
    remote_path:  "osx/10.14/x86_64"
    xcode:        "10.3"

  rvm:
    version:      "1.29.9-next (master)"
    updated:      "1 hour 3 minutes 39 seconds ago"
    path:         "/Users/jakob/.rvm"
    autolibs:     "[fail] Allow RVM to use package manager if found, fail if dependencies are missing. This is default."

  ruby:
    interpreter:  "ruby"
    version:      "2.6.0p0"
    date:         "2018-12-25"
    platform:     "x86_64-darwin17"
    patchlevel:   "2018-12-25 revision 66547"
    full_version: "ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-darwin17]"

  homes:
    gem:          "/Users/jakob/.rvm/gems/ruby-2.6.0"
    ruby:         "/Users/jakob/.rvm/rubies/ruby-2.6.0"

  binaries:
    ruby:         "/Users/jakob/.rvm/rubies/ruby-2.6.0/bin/ruby"
    irb:          "/Users/jakob/.rvm/rubies/ruby-2.6.0/bin/irb"
    gem:          "/Users/jakob/.rvm/rubies/ruby-2.6.0/bin/gem"
    rake:         "/Users/jakob/.rvm/gems/ruby-2.6.0/bin/rake"

  environment:
    PATH:         "/Users/jakob/.rvm/gems/ruby-2.6.0/bin:/Users/jakob/.rvm/gems/ruby-2.6.0@global/bin:/Users/jakob/.rvm/rubies/ruby-2.6.0/bin:/Users/jakob/.rvm/bin:~/.asdf/shims:/Users/jakob/.asdf/shims:/Users/jakob/.asdf/bin:/opt/local/Library/Frameworks/Python.framework/Versions/3.7/bin:/Users/jakob/.yarn/bin:/Users/jakob/.config/yarn/global/node_modules/.bin:/usr/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:./bin:/Users/jakob/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools"
    GEM_HOME:     "/Users/jakob/.rvm/gems/ruby-2.6.0"
    GEM_PATH:     "/Users/jakob/.rvm/gems/ruby-2.6.0:/Users/jakob/.rvm/gems/ruby-2.6.0@global"
    MY_RUBY_HOME: "/Users/jakob/.rvm/rubies/ruby-2.6.0"
    IRBRC:        "/Users/jakob/.rvm/rubies/ruby-2.6.0/.irbrc"
    RUBYOPT:      ""
    gemset:       ""
$ port installed | grep openssl
  openssl @1.1.1c_0 (active)
  p5.26-crypt-openssl-random @0.150.0_1 (active)
$ rvm autolibs status
---
value: fail
number: 2
runner: osx
description: Allow RVM to use package manager if found, fail if dependencies are missing. This is default.
$ which -a openssl
/opt/local/bin/openssl
/opt/local/bin/openssl
/usr/bin/openssl
/usr/bin/openssl
@koppen
Copy link
Author

koppen commented Sep 13, 2019

Attempt 2

Inspired by https://rvm.io/integration/macports-before-autolibs.

Configure compiler flags

export CFLAGS="-O2 -arch x86_64"
export LDFLAGS="-L/opt/local/lib"
export CPPFLAGS="-I/opt/local/include"

Force RVM to use the packages already installed

$ rvm --autolibs=disable install ruby-2.3.7
Warning, new version of rvm available '1.29.9', you are using older version '1.29.9-next'.
You can disable this warning with:   echo rvm_autoupdate_flag=0 >> ~/.rvmrc
You can enable auto-update with:     echo rvm_autoupdate_flag=2 >> ~/.rvmrc
You can update manually with:        rvm get VERSION                         (e.g. 'rvm get stable')

ruby-2.3.7 - #removing src/ruby-2.3.7 - please wait
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.14/x86_64/ruby-2.3.7.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Installing Ruby from source to: /Users/jakob/.rvm/rubies/ruby-2.3.7, this may take a while depending on your cpu(s)...
ruby-2.3.7 - #downloading ruby-2.3.7, this may take a while depending on your connection...
ruby-2.3.7 - #extracting ruby-2.3.7 to /Users/jakob/.rvm/src/ruby-2.3.7 - please wait
ruby-2.3.7 - #configuring - please wait
ruby-2.3.7 - #post-configuration - please wait
ruby-2.3.7 - #compiling - please wait
Error running '__rvm_make -j8',
please read /Users/jakob/.rvm/log/1568364792_ruby-2.3.7/make.log

There has been an error while running make. Halting the installation.

@koppen
Copy link
Author

koppen commented Sep 13, 2019

Attempt 3

Inspired by https://rvm.io/integration/macports-before-autolibs.

Install older version of OpenSSL into RVM

$ rvm pkg install openssl

Warning, new version of rvm available '1.29.9', you are using older version '1.29.9-next'.
You can disable this warning with:   echo rvm_autoupdate_flag=0 >> ~/.rvmrc
You can enable auto-update with:     echo rvm_autoupdate_flag=2 >> ~/.rvmrc
You can update manually with:        rvm get VERSION                         (e.g. 'rvm get stable')


Beware, 'rvm pkg ...' is deprecated, read about the new autolibs feature: 'rvm help autolibs'.

Checking requirements for osx.
Certificates bundle '/opt/local/etc/openssl/cert.pem' is already up to date.
Requirements installation successful.
Fetching openssl-1.0.1i.tar.gz to /Users/jakob/.rvm/archives
Extracting openssl to /Users/jakob/.rvm/src/openssl-1.0.1i.....
Configuring openssl in /Users/jakob/.rvm/src/openssl-1.0.1i.......................
Compiling openssl in /Users/jakob/.rvm/src/openssl-1.0.1i....................................................................................................-
Installing openssl to /Users/jakob/.rvm/usr..................................................................................................................|

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

    rvm reinstall all --force

Updating openssl certificates....

Set up compiler flags to use the openssl package inside~/.rvm

export CFLAGS="-O2 -arch x86_64"
export LDFLAGS="-L$HOME/.rvm/usr/lib -L/opt/local/lib"
export CPPFLAGS="-I$HOME/.rvm/usr/include -I/opt/local/include"

Install Ruby with the package inside ~/.rvm

$ rvm install 2.3.7 --with-openssl-dir=$HOME/.rvm/usr
Warning, new version of rvm available '1.29.9', you are using older version '1.29.9-next'.
You can disable this warning with:   echo rvm_autoupdate_flag=0 >> ~/.rvmrc
You can enable auto-update with:     echo rvm_autoupdate_flag=2 >> ~/.rvmrc
You can update manually with:        rvm get VERSION                         (e.g. 'rvm get stable')

Checking requirements for osx.
Certificates bundle '/opt/local/etc/openssl/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/jakob/.rvm/rubies/ruby-2.3.7, this may take a while depending on your cpu(s)...
ruby-2.3.7 - #downloading ruby-2.3.7, this may take a while depending on your connection...
ruby-2.3.7 - #extracting ruby-2.3.7 to /Users/jakob/.rvm/src/ruby-2.3.7 - please wait
ruby-2.3.7 - #configuring - please wait
ruby-2.3.7 - #post-configuration - please wait
ruby-2.3.7 - #compiling - please wait
ruby-2.3.7 - #installing - please wait
ruby-2.3.7 - #making binaries executable - please wait
ruby-2.3.7 - #downloading rubygems-3.0.6
ruby-2.3.7 - #extracting rubygems-3.0.6 - please wait
ruby-2.3.7 - #removing old rubygems - please wait
ruby-2.3.7 - #installing rubygems-3.0.6 - please wait
ruby-2.3.7 - #gemset created /Users/jakob/.rvm/gems/ruby-2.3.7@global
ruby-2.3.7 - #importing gemset /Users/jakob/.rvm/gemsets/global.gems - please wait
Error running 'command gem install /Users/jakob/.rvm/gem-cache/gem-wrappers-1.4.0.gem --local --no-document',
please read /Users/jakob/.rvm/log/1568365858_ruby-2.3.7/gem.install.gem-wrappers->=1.4.0.log
there was an error installing gem gem-wrappers
Error running 'command gem install rubygems-bundler --no-document',
please read /Users/jakob/.rvm/log/1568365858_ruby-2.3.7/gem.install.rubygems-bundler.log
there was an error installing gem rubygems-bundler
Error running 'command gem install /Users/jakob/.rvm/gem-cache/rvm-1.11.3.9.gem --local --no-document',
please read /Users/jakob/.rvm/log/1568365858_ruby-2.3.7/gem.install.rvm->=1.11.3.9.log
there was an error installing gem rvm
ruby-2.3.7 - #generating global wrappers - please wait
Error running 'command gem install /Users/jakob/.rvm/gem-cache/gem-wrappers-1.4.0.gem --local --no-document',
please read /Users/jakob/.rvm/log/1568365858_ruby-2.3.7/gem.install.gem-wrappers->=1.4.0.log
Error running 'run_gem_wrappers regenerate',
please read /Users/jakob/.rvm/log/1568365858_ruby-2.3.7/gemset.wrappers.global.log
ruby-2.3.7 - #gemset created /Users/jakob/.rvm/gems/ruby-2.3.7
ruby-2.3.7 - #importing gemsetfile /Users/jakob/.rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.3.7 - #generating default wrappers - please wait
Error running 'command gem install /Users/jakob/.rvm/gem-cache/gem-wrappers-1.4.0.gem --local --no-document',
please read /Users/jakob/.rvm/log/1568365858_ruby-2.3.7/gem.install.gem-wrappers->=1.4.0.log
Error running 'run_gem_wrappers regenerate',
please read /Users/jakob/.rvm/log/1568365858_ruby-2.3.7/gemset.wrappers.default.log
ruby-2.3.7 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.3.7 - #complete
Ruby was built without documentation, to build it run: rvm docs generate-ri

Ruby installs!

$ ruby -v
ruby 2.3.7p456 (2018-03-28 revision 63024) [x86_64-darwin18]

... alas without OpenSSL :(

$ bundle

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 http://rvm.io/packages/openssl.

@koppen
Copy link
Author

koppen commented Sep 13, 2019

Attempt 4

Install old version of openssl via ports.

$ sudo port install openssl10
--->  Computing dependencies for openssl10
--->  Fetching archive for openssl10
--->  Attempting to fetch openssl10-1.0.2s_0.darwin_18.x86_64.tbz2 from https://packages.macports.org/openssl10
--->  Attempting to fetch openssl10-1.0.2s_0.darwin_18.x86_64.tbz2.rmd160 from https://packages.macports.org/openssl10
--->  Installing openssl10 @1.0.2s_0
--->  Activating openssl10 @1.0.2s_0
--->  Cleaning openssl10
--->  Scanning binaries for linking errors
--->  No broken files found.
--->  No broken ports found.

Configure everything to use the old openssl installed via ports

export CFLAGS="-O2 -arch x86_64"
export LDFLAGS="-L/opt/local/lib/openssl-1.0 -L/opt/local/lib"
export CPPFLAGS="-I/opt/local/include/openssl-1.0 -I/opt/local/include"
export PKG_CONFIG_PATH=/opt/local/lib/openssl-1.0/pkgconfig
$ pkg-config --libs openssl
-L/opt/local/lib/openssl-1.0 -lssl -lcrypto

Install, relying on pkg-config and compiler flags in ENV

$ rvm install 2.3.7
Warning, new version of rvm available '1.29.9', you are using older version '1.29.9-next'.
You can disable this warning with:   echo rvm_autoupdate_flag=0 >> ~/.rvmrc
You can enable auto-update with:     echo rvm_autoupdate_flag=2 >> ~/.rvmrc
You can update manually with:        rvm get VERSION                         (e.g. 'rvm get stable')

ruby-2.3.7 - #removing src/ruby-2.3.7 - please wait
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.14/x86_64/ruby-2.3.7.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates bundle '/opt/local/etc/openssl/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/jakob/.rvm/rubies/ruby-2.3.7, this may take a while depending on your cpu(s)...
ruby-2.3.7 - #downloading ruby-2.3.7, this may take a while depending on your connection...
ruby-2.3.7 - #extracting ruby-2.3.7 to /Users/jakob/.rvm/src/ruby-2.3.7 - please wait
ruby-2.3.7 - #configuring - please wait
ruby-2.3.7 - #post-configuration - please wait
ruby-2.3.7 - #compiling - please wait
ruby-2.3.7 - #installing - please wait
ruby-2.3.7 - #making binaries executable - please wait
ruby-2.3.7 - #downloading rubygems-3.0.6
ruby-2.3.7 - #extracting rubygems-3.0.6 - please wait
ruby-2.3.7 - #removing old rubygems - please wait
ruby-2.3.7 - #installing rubygems-3.0.6 - please wait
ruby-2.3.7 - #gemset created /Users/jakob/.rvm/gems/ruby-2.3.7@global
ruby-2.3.7 - #importing gemset /Users/jakob/.rvm/gemsets/global.gems - please wait
Error running 'command gem install /Users/jakob/.rvm/gem-cache/gem-wrappers-1.4.0.gem --local --no-document',
please read /Users/jakob/.rvm/log/1568366810_ruby-2.3.7/gem.install.gem-wrappers->=1.4.0.log
there was an error installing gem gem-wrappers
Error running 'command gem install rubygems-bundler --no-document',
please read /Users/jakob/.rvm/log/1568366810_ruby-2.3.7/gem.install.rubygems-bundler.log
there was an error installing gem rubygems-bundler
Error running 'command gem install /Users/jakob/.rvm/gem-cache/rvm-1.11.3.9.gem --local --no-document',
please read /Users/jakob/.rvm/log/1568366810_ruby-2.3.7/gem.install.rvm->=1.11.3.9.log
there was an error installing gem rvm
ruby-2.3.7 - #generating global wrappers - please wait
Error running 'command gem install /Users/jakob/.rvm/gem-cache/gem-wrappers-1.4.0.gem --local --no-document',
please read /Users/jakob/.rvm/log/1568366810_ruby-2.3.7/gem.install.gem-wrappers->=1.4.0.log
Error running 'run_gem_wrappers regenerate',
please read /Users/jakob/.rvm/log/1568366810_ruby-2.3.7/gemset.wrappers.global.log
ruby-2.3.7 - #gemset created /Users/jakob/.rvm/gems/ruby-2.3.7
ruby-2.3.7 - #importing gemsetfile /Users/jakob/.rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.3.7 - #generating default wrappers - please wait
Error running 'command gem install /Users/jakob/.rvm/gem-cache/gem-wrappers-1.4.0.gem --local --no-document',
please read /Users/jakob/.rvm/log/1568366810_ruby-2.3.7/gem.install.gem-wrappers->=1.4.0.log
Error running 'run_gem_wrappers regenerate',
please read /Users/jakob/.rvm/log/1568366810_ruby-2.3.7/gemset.wrappers.default.log
ruby-2.3.7 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.3.7 - #complete
Ruby was built without documentation, to build it run: rvm docs generate-ri

It installs, but without OpenSSL...

$ bundle

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 http://rvm.io/packages/openssl.

@koppen
Copy link
Author

koppen commented Sep 13, 2019

Attempt 5

Configure pkg-config to find the old openssl version installed via ports

$ export | grep openssl
PKG_CONFIG_PATH=/opt/local/lib/openssl-1.0/pkgconfig

Configure RVM to install with the old openssl version

$ rvm install 2.3.7 --with-openssl-lib=/opt/local/lib/openssl-1.0 --with-openssl-include=/opt/local/include/openssl-1.0
Warning, new version of rvm available '1.29.9', you are using older version '1.29.9-next'.
You can disable this warning with:   echo rvm_autoupdate_flag=0 >> ~/.rvmrc
You can enable auto-update with:     echo rvm_autoupdate_flag=2 >> ~/.rvmrc
You can update manually with:        rvm get VERSION                         (e.g. 'rvm get stable')

Checking requirements for osx.
Certificates bundle '/opt/local/etc/openssl/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/jakob/.rvm/rubies/ruby-2.3.7, this may take a while depending on your cpu(s)...
ruby-2.3.7 - #downloading ruby-2.3.7, this may take a while depending on your connection...
ruby-2.3.7 - #extracting ruby-2.3.7 to /Users/jakob/.rvm/src/ruby-2.3.7 - please wait
ruby-2.3.7 - #configuring - please wait
ruby-2.3.7 - #post-configuration - please wait
ruby-2.3.7 - #compiling - please wait
ruby-2.3.7 - #installing - please wait
ruby-2.3.7 - #making binaries executable - please wait
ruby-2.3.7 - #downloading rubygems-3.0.6
ruby-2.3.7 - #extracting rubygems-3.0.6 - please wait
ruby-2.3.7 - #removing old rubygems - please wait
ruby-2.3.7 - #installing rubygems-3.0.6 - please wait
ruby-2.3.7 - #gemset created /Users/jakob/.rvm/gems/ruby-2.3.7@global
ruby-2.3.7 - #importing gemset /Users/jakob/.rvm/gemsets/global.gems - please wait
ruby-2.3.7 - #generating global wrappers - please wait
ruby-2.3.7 - #gemset created /Users/jakob/.rvm/gems/ruby-2.3.7
ruby-2.3.7 - #importing gemsetfile /Users/jakob/.rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.3.7 - #generating default wrappers - please wait
ruby-2.3.7 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.3.7 - #complete
Ruby was built without documentation, to build it run: rvm docs generate-ri
$ ruby -v
ruby 2.3.7p456 (2018-03-28 revision 63024) [x86_64-darwin18]
$ bundle
Could not locate Gemfile
$ ruby -e "require 'openssl'"

Conclusion

This attempt seems to fix the problem for me. I am not sure what to make of all this, but at least this issue is here for posterity now.

It seems I needed to

  1. Install an old, compatible version of OpenSSL
  2. Configure pkg-config to find that version of OpenSSL
  3. Configure RVM to use that version of OpenSSL, not just using --with-openssl-dir, but the specific flags for lib and include dirs.

It's possible that the same could be achieved with the RVM-installed package in ~/.rvm/usr, though.

@whs-dot-hk
Copy link

whs-dot-hk commented Nov 29, 2019

@koppen I successfully installed ruby 2.3.8 with

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/8c9b113bc6812dc74c598c8f860017e42fba8d78/Formula/openssl.rb
rvm install 2.3 --with-openssl-lib=/usr/local/opt/openssl/lib --with-openssl-include=/usr/local/opt/openssl/include
or
rvm install 2.3 --with-openssl-dir=/usr/local/opt/openssl

Thanks

@whs-dot-hk whs-dot-hk linked a pull request Dec 3, 2019 that will close this issue
@neemiasvf
Copy link

@koppen I successfully installed ruby 2.3.8 with

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/8c9b113bc6812dc74c598c8f860017e42fba8d78/Formula/openssl.rb
rvm install 2.3 --with-openssl-lib=/usr/local/opt/openssl/lib --with-openssl-include=/usr/local/opt/openssl/include
or
rvm install 2.3 --with-openssl-dir=/usr/local/opt/openssl

Thanks

For Catalina users, best use this commit. It's the latest commit for the 1.0.2 version.

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/8b9d6d688f483a0f33fcfc93d433de501b9c3513/Formula/openssl.rb
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"
rvm install 2.3.x --with-openssl-lib=/usr/local/opt/openssl/lib --with-openssl-include=/usr/local/opt/openssl/include

@jcrate
Copy link

jcrate commented Dec 11, 2019

If you use HomeBrew on macOS and don't wish to install an old version of openssl from an old commit and risk conflicts with other packages (lets just say my trust in Homebrew has gone way down this year with the silent updates enabling aggressive package updates and deletion of old packages), another option is to download the source from https://www.openssl.org/source/ and configure/make/install, and have RVM use that installation.

cd /usr/local/src
curl -O https://www.openssl.org/source/openssl-1.0.2t.tar.gz
tar xzf openssl-1.0.2t.tar.gz
cd openssl-1.0.2t
./Configure darwin64-x86_64-cc
make
make install

rvm install 2.3.8 --with-openssl-dir=/usr/local/ssl

@MisterSpicy
Copy link

@jcrate Everything here seemed to work for me until it came to installing gems - seems that the installation of openssl doesn't know where the root certificates are installed on OSX.

ONNECTED(00000005)
depth=1 C = US, O = DigiCert Inc, CN = DigiCert SHA2 Secure Server CA
verify error:num=20:unable to get local issuer certificate
verify return:0

@vekozlov
Copy link

If you use HomeBrew on macOS and don't wish to install an old version of openssl from an old commit and risk conflicts with other packages (lets just say my trust in Homebrew has gone way down this year with the silent updates enabling aggressive package updates and deletion of old packages), another option is to download the source from https://www.openssl.org/source/ and configure/make/install, and have RVM use that installation.

cd /usr/local/src
curl -O https://www.openssl.org/source/openssl-1.0.2t.tar.gz
tar xzf openssl-1.0.2t.tar.gz
cd openssl-1.0.2t
./Configure darwin64-x86_64-cc
make
make install

rvm install 2.3.8 --with-openssl-dir=/usr/local/ssl

Worked for me with Ruby 2.1.5 on Mojave 10.14.6.
Thanks. No other decision worked before that.

@whs-dot-hk
Copy link

whs-dot-hk commented Jan 24, 2020

Hi, I found this docker image works out of the box

$ podman build .
STEP 1: FROM ruby:2.3
Getting image source signatures
Copying blob d54db43011fd done
Copying blob 69d473365bb3 done
Copying blob e79bb959ec00 done
Copying blob 1b2a72d4e030 done
Copying blob d4b7902036fe done
Copying blob 84ed2a0dc034 done
Copying blob 8952ca0665c5 done
Copying blob ef485f36c624 done
Copying config c0d23ebb3e done
Writing manifest to image destination
Storing signatures
STEP 2: RUN ruby -ropen-uri -e 'eval open("https://git.io/vQhWq").read'
Here's your Ruby and OpenSSL environment:

Ruby:           2.3.8p459 (2018-10-18 revision 65136) [x86_64-linux]
RubyGems:       3.0.3
Bundler:        1.17.3
Compiled with:  OpenSSL 1.0.2r  26 Feb 2019
Loaded version: OpenSSL 1.0.2r  26 Feb 2019
SSL_CERT_FILE:  /usr/lib/ssl/cert.pem
SSL_CERT_DIR:   /usr/lib/ssl/certs

With that out of the way, let's see if you can connect to rubygems.org...

Bundler connection to rubygems.org:       success ✅
RubyGems connection to rubygems.org:      success ✅
Ruby net/http connection to rubygems.org: success ✅

Hooray! This Ruby can connect to rubygems.org. You are all set to use Bundler and RubyGems. 👌
STEP 3: COMMIT
166507dc05eb24c313414c02c426953a109feeb4aa6eed273d0cc20fcbf05190

Dockerfile

FROM ruby:2.3

RUN ruby -ropen-uri -e 'eval open("https://git.io/vQhWq").read'

Reference

https://bundler.io/v2.0/guides/rubygems_tls_ssl_troubleshooting_guide.html

@luckylu
Copy link

luckylu commented Jan 27, 2020

@koppen I successfully installed ruby 2.3.8 with

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/8c9b113bc6812dc74c598c8f860017e42fba8d78/Formula/openssl.rb
rvm install 2.3 --with-openssl-lib=/usr/local/opt/openssl/lib --with-openssl-include=/usr/local/opt/openssl/include
or
rvm install 2.3 --with-openssl-dir=/usr/local/opt/openssl

Thanks

It works for me!

@xta
Copy link

xta commented Feb 3, 2020

If you use HomeBrew on macOS and don't wish to install an old version of openssl from an old commit and risk conflicts with other packages (lets just say my trust in Homebrew has gone way down this year with the silent updates enabling aggressive package updates and deletion of old packages), another option is to download the source from https://www.openssl.org/source/ and configure/make/install, and have RVM use that installation.

cd /usr/local/src
curl -O https://www.openssl.org/source/openssl-1.0.2t.tar.gz
tar xzf openssl-1.0.2t.tar.gz
cd openssl-1.0.2t
./Configure darwin64-x86_64-cc
make
make install

rvm install 2.3.8 --with-openssl-dir=/usr/local/ssl

Worked for me with Ruby 2.1.5 on Mojave 10.14.6.
Thanks. No other decision worked before that.

This also works for me. Is there a better work around than making your own openssl?

@duende84
Copy link

duende84 commented Feb 3, 2020

If you use HomeBrew on macOS and don't wish to install an old version of openssl from an old commit and risk conflicts with other packages (lets just say my trust in Homebrew has gone way down this year with the silent updates enabling aggressive package updates and deletion of old packages), another option is to download the source from https://www.openssl.org/source/ and configure/make/install, and have RVM use that installation.

cd /usr/local/src
curl -O https://www.openssl.org/source/openssl-1.0.2t.tar.gz
tar xzf openssl-1.0.2t.tar.gz
cd openssl-1.0.2t
./Configure darwin64-x86_64-cc
make
make install

rvm install 2.3.8 --with-openssl-dir=/usr/local/ssl

Worked for me with Ruby 2.3.8 on Catalina 10.15.2.
I've tested all the other solutions in this issue and only this one works for me. Thanks.

@gulymaestro
Copy link

Here is what worked for me:

brew install rbenv/tap/openssl@1.0
rvm reinstall 2.3.8 --with-openssl-dir='/usr/local/opt/openssl@1.0'
gem update --system

Cheers!

@kaushik
Copy link

kaushik commented Apr 5, 2020

Here is what worked for me:

brew install rbenv/tap/openssl@1.0
rvm reinstall 2.3.8 --with-openssl-dir='/usr/local/opt/openssl@1.0'
gem update --system

Cheers!

This works well for me. Except that I had to add PKG_CONFIG_PATH. Thanks!

PKG_CONFIG_PATH="/usr/local/opt/openssl@1.0/lib/pkgconfig" rvm reinstall 2.6.3 --with-openssl-dir='/usr/local/opt/openssl@1.0'

@ShishirSK
Copy link

I was installing a newer version of Ruby on Mac Mojave and it was failing.

This was the error I was getting.

Error running '__rvm_make -j12',
please read /Users/user_name/.rvm/log/1588609415_ruby-2.6.3/make.log
There has been an error while running make. Halting the installation.

Installation succeeded with the below command.

rvm install 2.6.3 --with-openssl-dir=/usr/local/opt/openssl

Make sure the openssl-dir is correct, and it should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.