Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby 'Could not load OpenSSL' error macOS Sierra

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!

like image 897
chemo Avatar asked Feb 16 '17 22:02

chemo


1 Answers

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.

like image 118
Benji Avatar answered Oct 31 '22 11:10

Benji