$ brew install openssl
Warning: openssl-1.0.2a-1 already installed
$ openssl version
OpenSSL 0.9.8zd 8 Jan 2015
$ ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION'
OpenSSL 1.0.1j 15 Oct 2014
$ rvm -v
rvm 1.26.11 (latest) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]
I'm seeing a lot of discrepancies between the versions of openssl. Homebrew thinks it's on 1.0.2a-1, openssl itself thinks it's on 0.9.8zd, and Ruby thinks it's on 1.0.1j. I don't even know if any of these are actually up-to-date!
How can I resolve this discrepancy and get Ruby to use the correct version of OpenSSL? The fact that it's using the wrong version is stopping me from using secure APIs.
Installing OpenSSL with HomeBrew will not immediately link it as the default OpenSSL.
First, let's check which version are you using (on Jul 10, '15 the latest version is 1.0.2d):
openssl version -a
which openssl
ruby -r openssl -e 'puts OpenSSL::OPENSSL_VERSION'
Now, let's be sure to upgrade OpenSSL to the latest version:
brew update
brew install openssl
brew unlink openssl
brew link --force openssl
If you run the initial checks again, you should see the first 2 pointing to the newly installed OpenSSL. Ruby will most likely still point to the old one since it was compiled with it.
If it is pointing to the old version, let's recompile Ruby and point it to the new one. And just to be sure that it will use the correct version, let's pass the OpenSSL prefix -- although this shouldn't be needed since we linked homebrew's OpenSSL.
rvm get stable
rvm install ruby-2.1.6 --with-openssl-dir=`brew --prefix openssl`
(or rvm reinstall if you're already using 2.1.6)
This should do it.
Related
After installing Ruby 2.3.8 via RVM I get the following error when running bundle:
You must recompile Ruby with OpenSSL support or change the sources in your Gemfile
How do I recompile Ruby with OpenSSL support?
My Solution for this:
Just run
1: brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/8c9b113bc6812dc74c598c8f860017e42fba8d78/Formula/openssl.rb
2: rvm install 2.3 --with-openssl-lib=/usr/local/opt/openssl/lib --with-openssl-include=/usr/local/opt/openssl/include
(if rvm is already installed, use reinstall instead of install.)
For rvm on MacOS Mojave
In my case, the installer fails because it is using obsolete parts in the new version of openssl. This has worked for me:
Go to the "homebrew-core" folder and get back the old openssl gem(1.0.2t)
cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
git show 8b9d6d688f483a0f33fcfc93d433de501b9c3513:Formula/openssl.rb >> Formula/openssl\#1.0.2t.rb
Enter the file and rename the class "Openssl" to "OpensslAT102t"
brew edit Formula/openssl\#1.0.2t.rb
Install it with brew
brew install openssl#1.0.2t
Once installed, force rvm to use the installed version of ssl
# Install 2.3.8
rvm install 2.3.8 --disable-binary --with-openssl-dir=`brew --prefix openssl#1.0.2t`
# Or reinstall
rvm reinstall 2.3.8 --disable-binary --with-openssl-dir=`brew --prefix openssl#1.0.2t`
I have ruby version 2.1.5 installed on my system.
On running bundle install, I am getting
"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."
My Gemfile has soures with http only.
On executing "rvm pkg install openssl" :
==> Formulae
curl-openssl glib-openssl openssl#1.1 ✔ homebrew/portable-ruby/portable-openssl
There is no openssl#1.0 and openssl
How to degrade to openssl#1.0 from 1.0.
Already tried rvm reinstall 2.1.5 --with-openssl-dir=brew --prefix openssl#1.0
But it is of no use for me.
The previous solution doesn't work any more, I have succeeded with the following steps:
brew install rbenv/tap/openssl#1.0
ln -sfn /usr/local/Cellar/openssl#1.0/1.0.2t /usr/local/opt/openssl
I've seen this issue on rvm project where you can find more detail about this.
This step works for me, we have to wait for some official fix.
Install openssl via rvm pkg install openssl
Remove and reinstall rubies with rvm reinstall 2.1.5
--with-openssl-dir=$HOME/.rvm/usr
I have tried the solution on Mac OS X Catalina and it works.
Download the file: https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb
Run brew with the file downloaded: brew install openssl.rb
I'm attempting to install jekyll and I've encountered an error. I'm running Mac OS X 10.11.4 (El Capitan).
$gem install jekyll
ERROR : While executing gem ... (Gem::Exception)
Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources
$gem source -l
https://ruby.taobao.org
$which openssl
/usr/local/bin/openssl
I welcome your suggestions how to resolve this error.
Newer versions of OSX deprecated openSSL, leaving many dependencies broken. You need to reinstall ruby, but specify exactly where your openSSL libraries are. If you're using rvm then that looks like:
rvm reinstall 2.3.0 --with-openssl-dir=/usr/local/opt/openssl
If you're using homebrew, then a quick shortcut to where your libraries are is:
brew install openssl
rvm reinstall 2.3.0 --with-openssl-dir=`brew --prefix openssl`
Method 1 (Install OpenSSL)
Type all these commands in your Terminal (OSX) just to be extra sure you've done everything:
rvm get stable
brew update
brew doctor
brew install openssl
rvm install ruby-2.4 (or whatever version)
rvm use ruby-2.4 (or whatever version)
rvm gemset create jekyll
gem install jekyll
Finally, you need OpenSSL installed before you compile Ruby before you install Jekyll (or other gems)!
Method 2 (Reinstalling Ruby)
Newer versions of OSX deprecated openSSL.
You need to reinstall Ruby!
RVM with OpenSSL
rvm reinstall 2.3.0 --with-openssl-dir=/usr/local/opt/openssl
With the latest RVM version
rvm get stable
rvm reinstall ruby-2.3.0
homebrew and OpenSSL
brew install openssl
rvm reinstall 2.3.0 --with-openssl-dir=`brew --prefix openssl`
You just need to set this env variables so your compiler has the correct path for openssl libs (if using Homebrew on macOS, try brew info openssl to see this info):
$ export LDFLAGS=-L/usr/local/opt/openssl/lib
$ export CPPFLAGS=-I/usr/local/opt/openssl/include
# For pkg-config to find this software you may need to set:
$ export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig
Then reinstall your ruby (rvm reinstall ruby-version)
brew install openssl
brew info openssl # do the suggested options
$ export LDFLAGS=-L/usr/local/opt/openssl/lib
$ export CPPFLAGS=-I/usr/local/opt/openssl/include
# For pkg-config to find this software you may need to set:
$ export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig
rvm reinstall <version> --with-openssl-dir=`brew --prefix openssl`
For ubuntu 22.04. Ruby will not compile with openssl v3. Which is the openssl if you install it using brew.
Do this:
brew install openssl#1.1
rvm install 3.0.2 --with-openssl-dir=`brew --prefix openssl#1.1`
To solve this issue, you should install OpenSSL version 1.1, and link ruby to it while installing process.
Here the commands worked fine with me (macOS):
// install openssl#1.1
brew install openssl#1.1
// export PKG_CONFIG_PATH variable
export PKG_CONFIG_PATH=/opt/homebrew/opt/openssl#1.1/lib/pkgconfig
// reinstall your ruby version with openssl 1.1 dir
rvm reinstall 3.0.4 --with-openssl-dir=/opt/homebrew/opt/openssl#1.1
Considering the other answers related to openssl, we can see the same error yet when we try to execute as a superuser in some cases, as follows:
filipe#FILIPE:~$ sudo gem install bundler
ERROR: While executing gem ... (Gem::Exception)
Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources
Without superuser permissions, we can see a different behavior, a successful one, as follows:
filipe#FILIPE:~$ gem install bundler
Fetching: bundler-1.14.6.gem (100%)
Successfully installed bundler-1.14.6
Parsing documentation for bundler-1.14.6
Installing ri documentation for bundler-1.14.6
Done installing documentation for bundler after 4 seconds
1 gem installed
I've tried to install a new version of OpenSSL via Homebrew but it doesn't work. My actual OpenSSL version is 0.9.8 and I don't know what to do.
When I type on MacOS 10.8.4 brew install openssl the system brings to me the following error:
Error: openssl-1.0.1e already installed
So when I type openssl version I see this:
OpenSSL 0.9.8x 10 May 2012
How can I turn the actual version to the new version installed via Homebrew? Any tips?
My guess is that OS X has an older version of openssl in /usr/bin, and Homebrew places it's version in /usr/local/bin
Try
/usr/local/bin/openssl version
Edit: Before you try the above command, run:
brew link --force openssl
Trying to set up a new macbook for a colleague. Not going well.
First I install OpenSSL:
Heathers-MacBook-Pro:~ heather$ rvm pkg install openssl
Fetching openssl-1.0.1c.tar.gz to /Users/heather/.rvm/archives
######################################################################## 100.0%
Extracting openssl to /Users/heather/.rvm/src/openssl-1.0.1c
Configuring openssl in /Users/heather/.rvm/src/openssl-1.0.1c.
Compiling openssl in /Users/heather/.rvm/src/openssl-1.0.1c.
Installing openssl to /Users/heather/.rvm/usr
Please note that it's required to reinstall all rubies:
rvm reinstall all --force
Updating openssl certificates
Then I try to install ruby with openssl...
Heathers-MacBook-Pro:website heather$ rvm install 1.9.3 --with-openssl-dir=$HOME/.rvm/usr
Fetching yaml-0.1.4.tar.gz to /Users/heather/.rvm/archives
Extracting yaml to /Users/heather/.rvm/src/yaml-0.1.4
Configuring yaml in /Users/heather/.rvm/src/yaml-0.1.4.
Compiling yaml in /Users/heather/.rvm/src/yaml-0.1.4.
Installing yaml to /Users/heather/.rvm/usr
Installing Ruby from source to: /Users/heather/.rvm/rubies/ruby-1.9.3-p392, this may take a while depending on your cpu(s)...
ruby-1.9.3-p392 - #downloading ruby-1.9.3-p392, this may take a while depending on your connection...
ruby-1.9.3-p392 - #extracting ruby-1.9.3-p392 to /Users/heather/.rvm/src/ruby-1.9.3-p392
ruby-1.9.3-p392 - #extracted to /Users/heather/.rvm/src/ruby-1.9.3-p392
ruby-1.9.3-p392 - #configuring
ruby-1.9.3-p392 - #compiling
ruby-1.9.3-p392 - #installing
Removing old Rubygems files...
Installing rubygems-1.8.25 for ruby-1.9.3-p392 ...
Installation of rubygems completed successfully.
Saving wrappers to '/Users/heather/.rvm/bin'.
ruby-1.9.3-p392 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ruby-1.9.3-p392 - #importing default gemsets, this may take time ...
Install of ruby-1.9.3-p392 - #complete
Heathers-MacBook-Pro:website heather$ bundle update
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.
btw, the gem file says "source https://rubygems.org"
ideas?
OP actually saved my day!
In my case:
$ rvm pkg install openssl
$ rvm remove 2.4
$ rvm install 2.4 --with-openssl-dir=$HOME/.rvm/usr
$ gem install bundler
It's well described on ArchLinux wiki:
Ruby versions older than 2.4 require OpenSSL 1.0 but RVM will try to build them with OpenSSL 1.1.
So you can do (easiest):
$ rvm pkg install openssl
$ rvm reinstall 2.3.5 --with-openssl-dir=$HOME/.rvm/usr
You can see more solutions on ArchLinux wiki.
Try this:
rvm get head
rvm pkg remove
rvm requirements run # if brew gives you warnings about formulas to install, run "brew install" for each before moving on.
rvm reinstall [the version you need (i.e: 2.0.0)]
Installing Ruby 2.2 on macOS Mojave (10.14.2) with Homebrew.
Install Homebrew
brew install openssl
rvm install 2.2 --with-openssl-dir=/usr/local/opt/openssl
Don't use rvm pkg it's deprecated, use rvm autolibs enabled.
Here's how I installed rvm and ruby 2.3 on a mac with Catalina. The version of rvm installed was 1.29.9. OpenSSL 1.0.2 (downgrade) had to be installed. Note the "ipv4" in the gpg command.
gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
\curl -sSL https://get.rvm.io | bash -s stable
Download openssl 1.0.2 at https://www.openssl.org/source/
tar -xzf openssl-1.0.2t.tar.gz
cd openssl-1.0.2t
./Configure darwin64-x86_64-cc --prefix=/usr/local/opt/openssl#1.0
make
make test
sudo make install
rvm install 2.3.3 --with-openssl-dir=/usr/local/opt/openssl#1.0
ruby -v
ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION'
>> OpenSSL 1.0.2t 10 Sep 2019
On MacOS 10.12.2 installing openssl via brew, won't work. To fix it, run:
export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig:/usr/local/lib/pkgconfig
And then install Ruby via rvm.
EDIT:
More information about the reason behind the problem here.
For those who have issue with openssl 1.1 and Ruby 2.3 via RVM on Mac Mojave, you could try following commands. The problem is Ruby 2.3 is not compatible with openssl 1.1
rvm pkg install openssl
PKG_CONFIG_PATH=$HOME/.rvm/usr/lib/pkgconfig rvm reinstall 2.3.3 --with-openssl-dir=$HOME/.rvm/usr
Here is what worked for me:
brew install rbenv/tap/openssl#1.0
rvm reinstall 1.9.3-p551 --with-openssl-dir='/usr/local/opt/openssl#1.0'
gem update --system
Cheers!
For older version of ruby 2.2.10 on MacOS High Sierra 10.13.6 the only thing worked for me was:
switching to older OpenSSL version
brew switch openssl 1.0.2s
Than reinstalling ruby using --with-openssl-dir
rvm reinstall 2.2.10 --with-openssl-dir=/usr/local/Cellar/openssl/1.0.2s
So this worked for me:
rvm pkg install openssl
rvm reinstall all --force
I also had rvm autolibs rvm_pkg for readline support.
openssl version: 1.0.2k
This worked for me:
brew reinstall openssl
For rvm on MacOS
First, check and see if you have openssl installed. You should see something like this:
$ brew --prefix openssl
/usr/local/opt/openssl#1.1
If openssl is not installed, do so.
$ brew install openssl
$ brew unlink openssl
$ brew link --force openssl
If you have more than one openssl installed, consider removing all but one to make your life easier.
$ brew cleanup openssl
$ brew list --versions openssl
$ brew uninstall <unwanted-openssl-version-here>
Now reinstall the ruby version, specifying the desired openssl path.
$ rvm reinstall <your-version-here> --with-openssl-dir=`brew --prefix openssl`
Finally, verify that your ruby was compiled with the same openssl it was linked to. If you see the same version twice, you should be all set.
$ ruby -ropenssl -e'puts OpenSSL::OPENSSL_VERSION, OpenSSL::OPENSSL_LIBRARY_VERSION'
OpenSSL 1.1.1d 10 Sep 2019
OpenSSL 1.1.1d 10 Sep 2019
If later you install other versions of ruby, you will need to pass the same --with-openssl-dir argument. Alternatively, I believe you can set the following variables in your bash profile.
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$(brew --prefix openssl)/lib/pkgconfig"
export LIBRARY_PATH="$LIBRARY_PATH:$(brew --prefix openssl)/lib"
If the above doesn't work, remove the lines from your bash profile and just use the --with-openssl-dir argument as above.
Ref: https://github.com/rvm/rvm/issues/4562
Ref: https://bugs.ruby-lang.org/issues/12630
For anyone using macports I found the following got things working:
$ sudo port install openssl11
$ PKG_CONFIG_PATH="/opt/local/libexec/openssl11/lib/pkgconfig" rvm reinstall 2.7.5 --with-openssl-dir='/opt/local/libexec/openssl11'
For windows (using Ubuntu WSL), I need to use the different path where openssl is found.
$ rvm pkg install openssl
$ rvm remove 2.4
$ rvm install 2.4 --with-openssl-dir=/usr/local/rvm/usr
$ gem install bundler
Anyone on Mac using homebrew can use this command which worked for me.
rvm install 2.7.7 --with-openssl-dir=$(brew --prefix openssl)/lib