installing ruby 2.6.0 can't find openssl on Mojave
Description
Can't install Ruby 2.6 or head on Mac OS 10.14.2.
Steps to reproduce
- rvm get master
- rvm cleanup all
- rvm install 2.6.0
- rvm use 2.6.0
- cd some_project && bundle
Expected behavior
I expect it to work.
Actual behavior
"Could not load OpenSSL. You must recompile Ruby with OpenSSL support or change the sources in your Gemfile from 'https' to 'http'. "
I tried reinstalling with --force option too:
$ rvm reinstall 2.6.0 --force
ruby-2.6.0 - #removing src/ruby-2.6.0..
ruby-2.6.0 - #removing rubies/ruby-2.6.0..
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.14/x86_64/ruby-2.6.0.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Updating certificates bundle '/usr/local/etc/[email protected]/cert.pem'
Requirements installation successful.
Installing Ruby from source to: /Users/mal/.rvm/rubies/ruby-2.6.0, this may take a while depending on your cpu(s)...
ruby-2.6.0 - #downloading ruby-2.6.0, this may take a while depending on your connection...
ruby-2.6.0 - #extracting ruby-2.6.0 to /Users/mal/.rvm/src/ruby-2.6.0.....
ruby-2.6.0 - #configuring.......................................................................
ruby-2.6.0 - #post-configuration.
ruby-2.6.0 - #compiling..................................................................
ruby-2.6.0 - #installing...........
ruby-2.6.0 - #making binaries executable..
ruby-2.6.0 - #downloading rubygems-2.7.8
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 899k 100 899k 0 0 909k 0 --:--:-- --:--:-- --:--:-- 910k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.6.0 - #extracting rubygems-2.7.8.....
ruby-2.6.0 - #removing old rubygems........
ruby-2.6.0 - #installing rubygems-2.7.8.....................................
ruby-2.6.0 - #gemset created /Users/mal/.rvm/gems/ruby-2.6.0@global
ruby-2.6.0 - #importing gemset /Users/mal/.rvm/gemsets/global.gems.................there was an error installing gem gem-wrappers
................there was an error installing gem rubygems-bundler
.................there was an error installing gem rake
.................there was an error installing gem rvm
.................there was an error installing gem bundler
.
ruby-2.6.0 - #generating global wrappers................
Error running 'run_gem_wrappers regenerate',
please read /Users/mal/.rvm/log/1546144217_ruby-2.6.0/gemset.wrappers.global.log
ruby-2.6.0 - #gemset created /Users/mal/.rvm/gems/ruby-2.6.0
ruby-2.6.0 - #importing gemsetfile /Users/mal/.rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.6.0 - #generating default wrappers................
Error running 'run_gem_wrappers regenerate',
please read /Users/mal/.rvm/log/1546144217_ruby-2.6.0/gemset.wrappers.default.log
ruby-2.6.0 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.6.0 - #complete
Ruby was built without documentation, to build it run: rvm docs generate-ri
Making gemset ruby-2.6.0 pristine............................................................................
Making gemset ruby-2.6.0@global pristine............................................................................
The gemset wrappers log is:
$ more /Users/mal/.rvm/log/1546144217_ruby-2.6.0/gemset.wrappers.global.log
[2018-12-29 23:34:13] run_gem_wrappers
run_gem_wrappers ()
{
gem_install gem-wrappers > /dev/null && gem wrappers "$@" || return $?
}
current path: /Users/mal/.rvm/src/ruby-2.6.0
GEM_HOME=/Users/mal/.rvm/gems/ruby-2.6.0@global
GEM_PATH=/Users/mal/.rvm/gems/ruby-2.6.0@global
PATH=/Users/mal/.rvm/gems/ruby-2.6.0@global/bin:/Users/mal/.rvm/rubies/ruby-2.6.0/bin:/Users/mal/.rvm/bin:/usr/local/opt/coreutils/bin:/usr/local/opt/pkg-config/bin:/usr/local/opt/libtool/bin:/usr/local/opt/automake/bin:/usr/local/opt/autoconf/bin:/usr/local/opt/[email protected]/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Users/mal/.ec2/api/bin:/Users/mal/ruby/dev/spec/mspec/bin:/Users/mal/.bin:/usr/local/Cellar/node/6.8.1/bin:/usr/local/bin
command(2): run_gem_wrappers regenerate
++ gem_install gem-wrappers
++ typeset gem_name gem_version version_check
++ gem_version=
++ __rvm_parse_gems_args gem-wrappers
++ typeset gem=gem-wrappers
++ __rvm_string_match gem-wrappers '*.gem$'
++ typeset _string
++ _string=gem-wrappers
++ shift
++ (( 1 ))
++ case "${_string}" in
++ shift
++ (( 0 ))
++ return 1
++ gem_name=gem-wrappers
++ case "$gem" in
++ [[ -z '' ]]
++ __rvm_db gem_gem-wrappers_version gem_version
++ typeset value key variable
++ key=gem_gem-wrappers_version
++ variable=gem_version
++ value=
++ [[ -f /Users/mal/.rvm/user/db ]]
+++ __rvm_db_ /Users/mal/.rvm/user/db gem_gem-wrappers_version
+++ typeset __db __key __value
+++ __db=/Users/mal/.rvm/user/db
+++ __key=gem_gem-wrappers_version
+++ shift 2
+++ __value=
+++ case "${__value}" in
+++ __rvm_db_get /Users/mal/.rvm/user/db gem_gem-wrappers_version
+++ [[ -f /Users/mal/.rvm/user/db ]]
+++ __rvm_sed -n -e '\#^gem_gem-wrappers_version=# { s#^gem_gem-wrappers_version=##;; p; }' -e '/^$/d'
+++ sed -n -e '\#^gem_gem-wrappers_version=# { s#^gem_gem-wrappers_version=##;; p; }' -e '/^$/d'
++ value=
++ [[ -z '' ]]
++ [[ -f /Users/mal/.rvm/config/db ]]
+++ __rvm_db_ /Users/mal/.rvm/config/db gem_gem-wrappers_version
+++ typeset __db __key __value
+++ __db=/Users/mal/.rvm/config/db
+++ __key=gem_gem-wrappers_version
+++ shift 2
+++ __value=
+++ case "${__value}" in
+++ __rvm_db_get /Users/mal/.rvm/config/db gem_gem-wrappers_version
+++ [[ -f /Users/mal/.rvm/config/db ]]
+++ __rvm_sed -n -e '\#^gem_gem-wrappers_version=# { s#^gem_gem-wrappers_version=##;; p; }' -e '/^$/d'
+++ sed -n -e '\#^gem_gem-wrappers_version=# { s#^gem_gem-wrappers_version=##;; p; }' -e '/^$/d'
++ value='>=1.4.0'
++ [[ -n >=1.4.0 ]]
++ [[ -n gem_version ]]
++ eval 'gem_version='\''>=1.4.0'\'''
+++ gem_version='>=1.4.0'
++ true
++ (( 1 == 0 ))
++ gem_install_force
++ typeset __available_gem
++ typeset -a install_params
++ install_params=()
+++ ls -v1 /Users/mal/.rvm/gem-cache/gem-wrappers-.gem
+++ tail -n 1
++ __available_gem=
++ [[ -n '' ]]
++ [[ -n >=1.4.0 ]]
++ install_params+=(-v "${gem_version}")
+++ command gem --version
+++ gem --version
++ __rvm_version_compare 2.7.8 -ge 2.2
++ typeset first
+++ command printf %b '2.7.8\n2.2\n'
+++ __rvm_version_sort
+++ printf %b '2.7.8\n2.2\n'
+++ command head -n1
+++ head -n1
+++ command awk '-F[.-]' -v OFS=. '{ # split on "." and "-", merge back with "."
original=$0 # save original to preserve it before the line is changed
for (n=1; n<10; n++) { # iterate through max 9 components of version
$n=tolower($n) # ignore case for sorting
if ($n == "") $n="0" # treat non existing parts as 0
if ($n ~ /^p[0-9]/) $n=substr($n, 2) # old ruby -p notation
if ($n ~ /^[0-9](rc|b)/) $n=substr($n, 1, 1)". "substr($n, 2) # old jruby 0RC1 notation
if (n == 1 && $n ~ /^[0-9]/) $n="zzz."$n # first group must be a string
if (n > 1 && $n ~ /^[a-z]/) $n=" "$n # names go before numbers thanks to space
}
print $0"\t"original # print the transformed version and original separated by \t
# so we can extract original after sorting
}'
+++ awk '-F[.-]' -v OFS=. '{ # split on "." and "-", merge back with "."
original=$0 # save original to preserve it before the line is changed
for (n=1; n<10; n++) { # iterate through max 9 components of version
$n=tolower($n) # ignore case for sorting
if ($n == "") $n="0" # treat non existing parts as 0
if ($n ~ /^p[0-9]/) $n=substr($n, 2) # old ruby -p notation
if ($n ~ /^[0-9](rc|b)/) $n=substr($n, 1, 1)". "substr($n, 2) # old jruby 0RC1 notation
if (n == 1 && $n ~ /^[0-9]/) $n="zzz."$n # first group must be a string
if (n > 1 && $n ~ /^[a-z]/) $n=" "$n # names go before numbers thanks to space
}
print $0"\t"original # print the transformed version and original separated by \t
# so we can extract original after sorting
}'
+++ LC_ALL=C
+++ sort -t. -k 1,1d -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n
+++ awk '-F\t' '{print $2}'
++ first=2.2
++ case "$2" in
++ [[ 2.2 == \h\e\a\d ]]
++ [[ 2.2 == \2\.\2 ]]
++ return 0
++ install_params+=(--no-document)
++ install_params+=($rvm_gem_options)
++ __rvm_log_command 'gem.install.gem-wrappers->=1.4.0' 'installing gem gem-wrappers -v >=1.4.0 --no-document' command gem install gem-wrappers -v '>=1.4.0' --no-document
++ typeset name message _command_start _command_name
++ typeset -a _command
++ name='gem.install.gem-wrappers->=1.4.0'
++ message='installing gem gem-wrappers -v >=1.4.0 --no-document'
++ shift 2
++ _command=("$@")
++ _command_start=command
++ (( 7 ))
++ [[ command == *\=* ]]
++ _command_name=command
++ [[ command != *\=* ]]
++ __function_on_stack __rvm_log_command_internal
++ __rvm_string_includes '__function_on_stack __rvm_log_command gem_install_force gem_install run_gem_wrappers __rvm_log_dotted __rvm_log_command_internal __rvm_log_command gemset_initial __rvm_with gemset_create __rvm_initial_gemsets_create_gemsets __rvm_initial_gemsets_create __rvm_install_source ruby_install __rvm_install_ruby __rvm_reinstall_ruby __rvm_manage_rubies source __rvm_run_wrapper rvm' __rvm_log_command_internal
++ typeset __search '__text=__function_on_stack __rvm_log_command gem_install_force gem_install run_gem_wrappers __rvm_log_dotted __rvm_log_command_internal __rvm_log_command gemset_initial __rvm_with gemset_create __rvm_initial_gemsets_create_gemsets __rvm_initial_gemsets_create __rvm_install_source ruby_install __rvm_install_ruby __rvm_reinstall_ruby __rvm_manage_rubies source __rvm_run_wrapper rvm'
++ shift
++ for __search in "$@"
++ [[ __function_on_stack __rvm_log_command gem_install_force gem_install run_gem_wrappers __rvm_log_dotted __rvm_log_command_internal __rvm_log_command gemset_initial __rvm_with gemset_create __rvm_initial_gemsets_create_gemsets __rvm_initial_gemsets_create __rvm_install_source ruby_install __rvm_install_ruby __rvm_reinstall_ruby __rvm_manage_rubies source __rvm_run_wrapper rvm == *\ \_\_\r\v\m\_\l\o\g\_\c\o\m\m\a\n\d\_\i\n\t\e\r\n\a\l\ * ]]
++ return 0
++ __rvm_log_command_simple command gem install gem-wrappers -v '>=1.4.0' --no-document
++ __rvm_log_command_debug
+++ __rvm_date '+%Y-%m-%d %H:%M:%S'
+++ date '+%Y-%m-%d %H:%M:%S'
++ printf %b '[2018-12-29 23:34:13] command\n'
++ is_a_function command
++ typeset -f command
++ return 1
++ printf %b 'current path: /Users/mal/.rvm/src/ruby-2.6.0\n'
++ env
++ __rvm_grep -E '^GEM_HOME=|^GEM_PATH=|^PATH='
++ GREP_OPTIONS=
++ command grep -E '^GEM_HOME=|^GEM_PATH=|^PATH='
++ grep -E '^GEM_HOME=|^GEM_PATH=|^PATH='
++ printf %b 'command(7): command gem install gem-wrappers -v >=1.4.0 --no-document\n'
++ rvm_log 'installing gem gem-wrappers -v >=1.4.0 --no-document'
++ [[ '' == 1 ]]
++ printf %b 'installing gem gem-wrappers -v >=1.4.0 --no-document\n'
++ command gem install gem-wrappers -v '>=1.4.0' --no-document
++ gem install gem-wrappers -v '>=1.4.0' --no-document
ERROR: While executing gem ... (Gem::Exception)
Unable to require openssl, install OpenSSL and rebuild Ruby (preferred) or use non-HTTPS sources
++ return 1
++ return 1
++ return 1
++ return 1
++ return 1
Environment info
ruby-2.6.0:
system:
uname: "Darwin malr 18.2.0 Darwin Kernel Version 18.2.0: Mon Nov 12 20:24:46 PST 2018; root:xnu-4903.231.4~2/RELEASE_X86_64 x86_64"
name: "OSX"
version: "10.14"
architecture: "x86_64"
bash: "/usr/local/bin/bash => GNU bash, version 4.4.12(1)-release (x86_64-apple-darwin15.6.0)"
zsh: "/bin/zsh => zsh 5.3 (x86_64-apple-darwin18.0)"
remote_path: "osx/10.14/x86_64"
xcode: "10.1"
rvm:
version: "1.29.7 (master)"
updated: "1 hour 22 minutes 11 seconds ago"
path: "/Users/mal/.rvm"
autolibs: "[enable] Allow RVM to use package manager if found, install missing dependencies, install package manager (only OS X)."
ruby:
interpreter: "ruby"
version: "2.6.0p0"
date: "2018-12-25"
platform: "x86_64-darwin18"
patchlevel: "2018-12-25 revision 66547"
full_version: "ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-darwin18]"
homes:
gem: "/Users/mal/.rvm/gems/ruby-2.6.0"
ruby: "/Users/mal/.rvm/rubies/ruby-2.6.0"
binaries:
ruby: "/Users/mal/.rvm/rubies/ruby-2.6.0/bin/ruby"
irb: "/Users/mal/.rvm/rubies/ruby-2.6.0/bin/irb"
gem: "/Users/mal/.rvm/rubies/ruby-2.6.0/bin/gem"
rake: "/Users/mal/.rvm/gems/ruby-2.6.0@global/bin/rake"
environment:
PATH: "/Users/mal/.rvm/gems/ruby-2.6.0/bin:/Users/mal/.rvm/gems/ruby-2.6.0@global/bin:/Users/mal/.rvm/rubies/ruby-2.6.0/bin:/Users/mal/.rvm/bin:/usr/local/opt/[email protected]/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Users/mal/.ec2/api/bin:/Users/mal/ruby/dev/spec/mspec/bin:/Users/mal/.bin:/usr/local/Cellar/node/6.8.1/bin:/usr/local/bin"
GEM_HOME: "/Users/mal/.rvm/gems/ruby-2.6.0"
GEM_PATH: "/Users/mal/.rvm/gems/ruby-2.6.0:/Users/mal/.rvm/gems/ruby-2.6.0@global"
MY_RUBY_HOME: "/Users/mal/.rvm/rubies/ruby-2.6.0"
IRBRC: "/Users/mal/.rvm/rubies/ruby-2.6.0/.irbrc"
RUBYOPT: ""
gemset: ""
I am having a very similar issue. I thought maybe it has something to do with libressl but I notice that rvm installs it's own openssl library, but that it is not being used when building Ruby.
I actually should clarify believe in my case this is specifically an issue with Ruby versions at 2.4 and older. Looking at my debug logs, it appears that osx_brew thinks I need openssl 1.1 when I actually require 1.0 for it to compile correctly. I believe either ruby in rvm should be able to use 1.1 or the package detector should not just assume it needs openssl 1.1.
Further data, I have a coworker, who also worked on a fresh instance of Mojave, they are on 10.14.1 and I am on 10.14.2. They had no issue installing any ruby versions via rvm. I wonder if that minor version bump of osx is causing this issue.
They are also on rvm 1.29.4
While I am on rvm 1.29.7
I also see this with RVM 1.29.7, but not 1.29.4. Reverting back to 1.29.4 with rvm get 1.29.4 seems to work for the time being.
also seeing this for ruby-2.3.1 worked around it with rvm reinstall ruby-2.3.1 --with-openssl-dir=brew --prefix openssl
also seeing this for
ruby-2.3.1worked around it withrvm reinstall ruby-2.3.1 --with-openssl-dir=brew --prefix openssl
rvm reinstall ruby-2.3.1 --with-openssl-dir=brew --prefix openssl - calling this gives an error:
Unrecognized command line flag: '--prefix'
But calling rvm reinstall ruby-2.3.1 --with-openssl-dir= and appending the output of brew --prefix openssl did the trick. Thanks!
You are missing the `` around brew --prefix openssl
I tried:
rvm reinstall 2.6.0 --with-openssl-dir=`brew --prefix openssl`
I still get "Could not load OpenSSL." error when trying to bundle.
@marcandre you may want to make sure that brew has openssl installed and that brew --prefix openssl outputs the correct ssl version for your ruby version.
Looks ok to me. I even tried again after a brew update && brew upgrade.
$ brew --prefix openssl
/usr/local/opt/openssl
$ ls -al /usr/local/opt/openssl
lrwxr-xr-x 1 mal admin 24 17 Jan 13:17 /usr/local/opt/openssl -> ../Cellar/openssl/1.0.2q
You may want to give 1.1 a shot instead of 1.0.2q. I know older versions did not like 1.0.2 maybe newer ones don't like 1.0.2
seems like this is still a bug though right? rvm automagically found brew installed openssl before.
yes either way rvm should detect the right openssl to compile with
if you run that with --debug do you see anything else of note?
I didn't see anything. Of course what doesn't help is that installation succeeds, but it's when actually using it that loading openssl fails. Here's the log
One thing I noticed is you are using gcc to build Ruby from source in the logs. I can't recall if it was that way when I built 2.6.0 but I would assume you would use the compiler that comes with xcode.
That is also one difference between our environments, I am using xcode 9.4.1 instead of 10
Possibly #4583 fixed it. Can anybody try again after rvm get master?
With 2.4.2 I can successfully see openssl being found
$ rvm reinstall 2.4.2
$ ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION'
OpenSSL 1.1.1a 20 Nov 2018
will try 2.6.0 next