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

installing ruby 2.6.0 can't find openssl on Mojave #4562

Closed
marcandre opened this issue Dec 30, 2018 · 49 comments
Closed

installing ruby 2.6.0 can't find openssl on Mojave #4562

marcandre opened this issue Dec 30, 2018 · 49 comments
Milestone

Comments

@marcandre
Copy link

Description

Can't install Ruby 2.6 or head on Mac OS 10.14.2.

Steps to reproduce

  1. rvm get master
  2. rvm cleanup all
  3. rvm install 2.6.0
  4. rvm use 2.6.0
  5. 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:       ""
@efagerberg
Copy link

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.

@efagerberg
Copy link

efagerberg commented Jan 15, 2019

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.

@efagerberg
Copy link

efagerberg commented Jan 15, 2019

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

@seanpcoyle
Copy link

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.

@aaronmallen
Copy link

also seeing this for ruby-2.3.1 worked around it with rvm reinstall ruby-2.3.1 --with-openssl-dir=brew --prefix openssl

@OlegsBoldirevs
Copy link

also seeing this for ruby-2.3.1 worked around it with rvm 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!

@efagerberg
Copy link

efagerberg commented Jan 17, 2019

You are missing the `` around brew --prefix openssl

@marcandre
Copy link
Author

marcandre commented Jan 17, 2019

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.

@efagerberg
Copy link

@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.

@marcandre
Copy link
Author

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

@efagerberg
Copy link

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

@aaronmallen
Copy link

seems like this is still a bug though right? rvm automagically found brew installed openssl before.

@efagerberg
Copy link

yes either way rvm should detect the right openssl to compile with

@marcandre
Copy link
Author

I tried

rvm reinstall 2.6.0 --with-openssl-dir=`brew --prefix [email protected]`

Same result 😢

@efagerberg
Copy link

if you run that with --debug do you see anything else of note?

@marcandre
Copy link
Author

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

@efagerberg
Copy link

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.

@efagerberg
Copy link

That is also one difference between our environments, I am using xcode 9.4.1 instead of 10

@pkuczynski
Copy link
Member

Possibly #4583 fixed it. Can anybody try again after rvm get master?

@pkuczynski pkuczynski added this to the rvm-1.29.8 milestone Jan 21, 2019
@efagerberg
Copy link

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

@efagerberg
Copy link

Confirmed the same for 2.6.0 for my machine thanks for mentioning that recent change @pkuczynski.

@pkuczynski
Copy link
Member

Great! Sorry for the bug!

@fagianijunior
Copy link

fagianijunior commented Feb 3, 2019

also seeing this for ruby-2.3.1 worked around it with rvm reinstall ruby-2.3.1 --with-openssl-dir=brew --prefix openssl

with `` works for me
rvm reinstall ruby-2.5.1 --with-openssl-dir=brew --prefix openssl

@marcandre
Copy link
Author

Issue remains for me.

I did rvm get head and tried reinstalling 2.6.0 with three different commands:

rvm reinstall ruby-2.6
rvm reinstall ruby-2.6 --with-openssl-dir=`brew --prefix openssl`
rvm reinstall ruby-2.6 --with-openssl-dir=`brew --prefix [email protected]` 

Could this be reopened please?

@pkuczynski
Copy link
Member

Could you please try:

rvm get master
rvm remove 2.6
rvm install 2.5

If it does not work, please provide gist with all logs

@marcandre
Copy link
Author

@pkuczynski You probably meant rvm install 2.6, not 2.5. I don't what has changed, but I'm running into install failures now (instead of installing finishing but openssl not being found later). I opened #4608 instead

@pkuczynski
Copy link
Member

Yeah, I meant 2.6 of course, sorry. I will have a look at #4608

@marcandre
Copy link
Author

So... trying to install ruby 2.5.x or 2.4.x leads into errors as #4608, but installing 2.6.x still works, without openssl loaded properly.
Help / things to check would really be appreciated. Also is it possible to reopen this issue?

@wernerlaude
Copy link

rvm reinstall ruby-2.3.1 --with-openssl-dir='/usr/local/opt/openssl'
worked for me..

@DRneilC
Copy link

DRneilC commented Mar 6, 2019

rvm reinstall ruby-2.3.1 --with-openssl-dir='/usr/local/opt/openssl'
worked for me..

@pchaganti
Copy link

👍

@ecbrodie
Copy link

Just going to mention that I ran into this issue today while setting up a new workspace for a Ruby project. Installed the latest version of rvm, 1.29.7. Had issues with OpenSSL when running a gem install command.

$ gem install bundler
ERROR:  While executing gem ... (Gem::Exception)
    Unable to require openssl, install OpenSSL and rebuild Ruby (preferred) or use non-HTTPS sources

My coworker who's running rvm version 1.29.3 did not run into the same issues that I was.

@ycrepeau
Copy link

Ok, I figured out.

  1. brew reinstall openssl
  2. Follow the recommendations (depends if you use zsh, csh, bash, fish...) In my case (fish):
If you need to have openssl first in your PATH run:
  echo 'set -g fish_user_paths "/usr/local/opt/openssl/bin" $fish_user_paths' >> ~/.config/fish/config.fish

For compilers to find openssl you may need to set:
  set -gx LDFLAGS "-L/usr/local/opt/openssl/lib"
  set -gx CPPFLAGS "-I/usr/local/opt/openssl/include"

For pkg-config to find openssl you may need to set:
  set -gx PKG_CONFIG_PATH "/usr/local/opt/openssl/lib/pkgconfig"
  1. rvm reinstall 2.6.3 --force --with-openssl-dir=/usr/local/opt/openssl

I had an older version (2.4.1) where openssl was not a problem. I went to the sources directories and compared the Makefile, the congigure.log etc. The missing part was LDFLAGS and CPPFLAGS.

@pchaganti
Copy link

None of the other suggestions worked for me on Mojave. This worked :

export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig
rvm install 2.6.3 --with-openssl-dir=/usr/local/opt/openssl --with-openssl-lib=/usr/local/opt/openssl/lib --with-openssl-include=/usr/local/opt/openssl/include

@cnhuye
Copy link

cnhuye commented Oct 21, 2019

None of the other suggestions worked for me on Mojave. This worked :

export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig
rvm install 2.6.3 --with-openssl-dir=/usr/local/opt/openssl --with-openssl-lib=/usr/local/opt/openssl/lib --with-openssl-include=/usr/local/opt/openssl/include

Only your solution works for me ! Thanks !

@gabrielmoterani
Copy link

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

Worked for me too! Awsome! Thanks

@skunkworker
Copy link
Contributor

Also works for 2.6.5. I was having openssl issues causing make to fail without it.

@kingdonb
Copy link

kingdonb commented Dec 6, 2019

I haven't had any problems with newer versions, but installing Ruby 2.3.8 with my RVM at version:

rvm 1.29.9 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]

... I did need the instructions from #4562 (comment), OS is Mojave 10.14.6. That's interesting... I don't seem to have had any of those issues installing 2.6.5 or 2.7.0-preview2

I have recently dumped my entire ~/.rvm directory and have some older apps to support, which have yet to be upgraded into 2.4.x, which is why I'm installing 2.3.8, and these instructions were the only ones that helped.

(thanks @pchaganti !)

@sam0x17
Copy link

sam0x17 commented Dec 11, 2019

for me, adding these lines to my .zshrc file fixed it completely:

export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
export CPPFLAGS="-I/usr/local/opt/[email protected]/include"
export PKG_CONFIG_PATH="PKG_CONFIG_PATH:/usr/local/opt/[email protected]/lib/pkgconfig"

These lines were in the comments when I ran brew link openssl

It also turned out I had an existing PKG_CONFIG_PATH line set for a previous version of openssl, so I removed that.

@prasanthrubyist
Copy link

For me helped this https://stackoverflow.com/questions/15511943/troubles-with-rvm-and-openssl

@shamilovtim
Copy link

@nijeesh4all
Copy link

when i run
> ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION'
i am getting output as
LibreSSL 2.6.5

@taiar
Copy link

taiar commented Feb 29, 2020

My problem was I had autolibs enabled in RVM. Once I disabled it with rvm autolibs disable and runned @pchaganti suggested commands, everything worked.

On MacOS Mojave and Ruby 2.6.4.

Thanks!

@garlou
Copy link

garlou commented May 12, 2020

Only this worked for me on Mojave:

brew install rbenv/tap/[email protected] # installed openssl 1.0.2t
PKG_CONFIG_PATH=/usr/local/Cellar/[email protected]/1.0.2t/lib/pkgconfig rvm install 2.3.3 --with-openssl-dir=/usr/local/Cellar/[email protected]/1.0.2t --with-openssl-lib=/usr/local/Cellar/[email protected]/1.0.2t/lib --with-openssl-include=/usr/local/Cellar/[email protected]/1.0.2t/include --rubygems ignore

@idanci
Copy link

idanci commented May 31, 2020

Only this worked for me on Mojave:

brew install rbenv/tap/[email protected] # installed openssl 1.0.2t
PKG_CONFIG_PATH=/usr/local/Cellar/[email protected]/1.0.2t/lib/pkgconfig rvm install 2.3.3 --with-openssl-dir=/usr/local/Cellar/[email protected]/1.0.2t --with-openssl-lib=/usr/local/Cellar/[email protected]/1.0.2t/lib --with-openssl-include=/usr/local/Cellar/[email protected]/1.0.2t/include --rubygems ignore

Also worked for Catalina, thank you!

@JulianKingman
Copy link

Without a workaround, this is still an issue, can it be re-opened?
@garlou's solution worked, but I would rather use the default (newly updated) [email protected], so that I don't run into difficulties later.

@swistak
Copy link

swistak commented Oct 15, 2020

Head is still not working properly - 1.29.10-next

What worked for me after a lot of fighting.

Version: Mojave 10.14.6
Ruby version needed: 2.2.10 (Ruby 2.2)

brew install rbenv/tap/[email protected]
export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
export CPPFLAGS="-I/usr/local/opt/[email protected]/include"
export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig"
rvm_rubygems_version=2.7.3 rvm reinstall ruby-2.2.10 --with-openssl-dir=/usr/local/Cellar/[email protected]/1.0.2t --with-openssl-lib=/usr/local/Cellar/[email protected]/1.0.2t/lib --with-openssl-include=/usr/local/Cellar/[email protected]/1.0.2t/include

@nerfologist
Copy link

Only this worked for me on Mojave:

brew install rbenv/tap/[email protected] # installed openssl 1.0.2t
PKG_CONFIG_PATH=/usr/local/Cellar/[email protected]/1.0.2t/lib/pkgconfig rvm install 2.3.3 --with-openssl-dir=/usr/local/Cellar/[email protected]/1.0.2t --with-openssl-lib=/usr/local/Cellar/[email protected]/1.0.2t/lib --with-openssl-include=/usr/local/Cellar/[email protected]/1.0.2t/include --rubygems ignore

This still works for me on Big Sur 11.2.1, to install ruby 2.3.7 (change 2.3.3 to 2.3.7).

@alexventuraio
Copy link

Only this worked for me on Mojave:

brew install rbenv/tap/[email protected] # installed openssl 1.0.2t
PKG_CONFIG_PATH=/usr/local/Cellar/[email protected]/1.0.2t/lib/pkgconfig rvm install 2.3.3 --with-openssl-dir=/usr/local/Cellar/[email protected]/1.0.2t --with-openssl-lib=/usr/local/Cellar/[email protected]/1.0.2t/lib --with-openssl-include=/usr/local/Cellar/[email protected]/1.0.2t/include --rubygems ignore

This worked for me on Mac OS Ventura 13.2.1 (22D68) Apple M1 Pro having OpenSSL 1.0 following this:

I hope it helps someone else in 2023! ✌🏻🙂

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

No branches or pull requests