7

I just downloaded Ruby, Git, Rails, and Homebrew today. I installed ruby via rvm v. 1.29.0 My Ruby is version 2.4.0, Rails is 5.0.1. My macOS is 10.12 Sierra.

When I tried to make a test app by doing rails new test_app it gave me an error:

`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.`        
    run  bundle exec spring binstub --all
bundler: command not found: spring
Install missing gem executables with `bundle install`

So I tried a bundle install command, in which the same error

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.

appeared.

Could you help me figure this one out? I've been looking everywhere on Google and here for possible help, but nothing seems to be working. I've tried the rvm pkg install openssl command and reinstalled Ruby, but to no avail. Thanks!

chemo
  • 163
  • 2
  • 3
  • 9
  • Have you tried this: http://stackoverflow.com/questions/15212104/ruby-and-you-must-recompile-ruby-with-openssl-support-or-change-the-sources-in – LucasM Feb 16 '17 at 22:55
  • I did see the link and read through it, but it was a different version of ruby(2.0.0), so I wasn't sure if I should just follow the exact steps, just with my version(2.4.0). – chemo Feb 16 '17 at 23:00
  • Try following this tutorial, it worked for me. I just reinstalled everything following the instructions and the problem fixed itself. http://railsapps.github.io/installrubyonrails-mac.html – Afas Mar 15 '17 at 22:00

1 Answers1

5

If you are using RVM, you can use:

rvm install "<ruby-version>" --with-openssl-dir=`brew --prefix openssl`

to install your version of ruby with OpenSSL. This should allow your bundle to connect to Gemservers over https.

Benji
  • 59
  • 2
  • 4
  • When run the command like - `rvm install "1.9.3-p484" --with-openssl-dir=``brew --prefix openssl` following error - `Error running 'requirements_debian_libs_install libssl1.0-dev',` – Sanaulla Oct 12 '21 at 06:42
  • Are you running on Mac or Linux? The above command onlt works on Mac, as `brew` is the Mac package manager (`apt-get` is for Liunx) – Benji May 25 '22 at 10:53
  • Yes, I am on Linux. Thanks for your suggestion. – Sanaulla May 26 '22 at 08:11
  • The above answer doesn't work, and my answer is deleted, so posting here. `rvm install 3.0.3 --with-openssl-dir=/opt/homebrew/etc/openssl@1.1` PS. Find the correct openssl location in your machine and install ruby pointing to that path like above, mentioning the brew installed openssl@3 path doesnot work. – Logesh Paul Feb 08 '23 at 15:06
  • 1
    `brew --prefix openssl` giving this in `--with-openssl-dir` doesn't work for me – Logesh Paul Feb 08 '23 at 15:07