On Mac Catalina OS, while installing Ruby with rbenv, I am getting this error.
Last 10 log lines:
The Ruby openssl extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Configure options used:
--prefix=/Users/dev/.rbenv/versions/2.5.8
--with-openssl-dir=/usr/local/opt/openssl#1.1
--enable-shared
--with-readline-dir=/usr/local/opt/readline
CC=clang
LDFLAGS=-L/Users/dev/.rbenv/versions/2.5.8/lib
CPPFLAGS=-I/Users/dev/.rbenv/versions/2.5.8/include
EDIT - I have attached the solution which I found and worked for me. I hope this helps others too.
The issue is with OpenSSL. Mac CommandLine Tools is coming with OpenSSL 1.1 whereas you need OpenSSL 1.0. This is the solution for it
$ brew install rbenv/tap/openssl#1.0
$ RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl#1.0)" rbenv install 2.5.8
This will install Ruby 2.5.8. Do not forget to set
rbenv global 2.5.8
to make it work
Related
I get this openssl error when trying to install/update any gem, although I have openSSL installed through brew install openssl.
This can be frustrating but there is a way to address this problem.
To address this problem, you need to:
Install openssl: brew install openssl
Using whatever package manager you use for ruby (rbenv, rvm, frum), reinstall the ruby version you need to work with, using the cli option for specifying the openssl directory to be used by the ruby version being installed.
For rvm that means:
rvm reinstall 2.3.0 — with-openssl-dir=`brew —-prefix openssl`
For frum:
frum uninstall <ruby version>
frum install <ruby version> --with-openssl-dir=<ssl_dir> # Specify the OpenSSL directory
This guide was geared towards MacOS. Similarly, you should reinstall ruby with the right cli options on whichever operating system you are using.
I am trying to install the ruby version 2.3.5 in my mac OS environment which is Mojave. I am getting the following issues. Appreciate If anyone can help me to sort out the issue ?
ERROR: Ruby install aborted due to missing extensions
Configure options used:
--prefix=/Users/efutures/.rbenv/versions/2.3.5
--with-openssl-dir=/usr/local/opt/openssl#1.1
--with-readline-dir=/usr/local/opt/readline
CC=clang
CFLAGS= -O3 -Wno-error=shorten-64-to-32
LDFLAGS=-L/Users/efutures/.rbenv/versions/2.3.5/lib
CPPFLAGS=-I/Users/efutures/.rbenv/versions/2.3.5/include
I tried the following command.
rbenv install 2.3.5
Found an issue in rbenv repo which suggests that you need an extension to get rbenv to properly work.
Follow the instruction here to install and get rbenv to work properly.
rbenv is a ruby manager. It builds different ruby from source. To make it work, you need to install rbenv and rbenv-build.
brew install rbenv rbenv-build
Secondly, you need to install dependencies readline and openssl#1.1.
brew install realine openssl#1.1
The error missing extensions is related to ruby-build, you may forget to install it or the dependencies.
I've hit the problem of setup of RVM + Rubies on a new Mac laptop where after getting RVM installed plus Homebrew the install for Rails hits the error:
ERROR: While executing gem ... (Gem::Exception)
Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources
Background and Environment
Mac OS X 10.12.3. (Sierra)
Homebrew 1.1.8. with OpenSSL installed
RVM 1.28.0
Ruby 2.3.3 Rails (attempting to install the latest)
Environment variables (following OpenSSL crate fails compilation on Mac OS X 10.11) the following variables have been setup in the Shell environment
LDFLAGS = -L/usr/local/opt/openssl#1.1/lib
CPPFLAGS = -I/usr/local/opt/openssl#1.1/include
PKG_CONFIG_PATH = /usr/local/opt/openssl#1.1/lib/pkgconfig
Discoveries & Fault Diagnosis
Starting with a clean laptop I had followed the usual path of installing Homebrew, Xcode command line tools, MySQL (for rails dev), Git and then RVM. Even with the environment variables set and also uninstalling and rebuild of RVM, removing and re-adding OpenSSL within Homebrew, when trying to get Rails installed I'm greeted with the error:
ERROR: While executing gem ... (Gem::Exception)
Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources
The other item to note is that when installing RVM I made sure that RVM was aware of Homebrew:
rvm autolibs enable
ram autolibs homebrew
The output from the install of ruby-2.3.3 is below:
Searching for binary rubies, this might take some time.
Found remote file https://rubies.travis-ci.org/osx/10.12/x86_64/ruby-2.3.3.tar.bz2
Checking requirements for osx_brew.
Updating Homebrew...
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
ruby-2.3.3 - #configure
ruby-2.3.3 - #download
ruby-2.3.3 - #validate archive
ruby-2.3.3 - #extract
ruby-2.3.3 - #validate binary
Libraries missing for ruby-2.3.3: /Users/travis/.rvm/rubies/ruby-2.3.3/lib/libruby.2.3.0.dylib. Refer to your system manual for installing libraries
Mounting remote ruby failed with status 10, trying to compile.
Checking requirements for osx_brew.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/grantsayer/.rvm/rubies/ruby-2.3.3, this may take a while depending on your cpu(s)...
ruby-2.3.3 - #downloading ruby-2.3.3, this may take a while depending on your connection...
ruby-2.3.3 - #extracting ruby-2.3.3 to /Users/grantsayer/.rvm/src/ruby-2.3.3
Next Steps
Currently I'm stuck - not been able to get past this step or validate through reviewing other postings to get a solution that works.
Well I found a solution to the problem previously described. The following steps outline how it was resolved.
CleanUp
Removed the installation of Homebrew via ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
Removed the installation of RVM via rvm implode
Rebuild
Install Homebrew using ruby -e "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/master/install)"
Do integrity check on Brew using brew upgrade followed by brew doctor
Install RVM (again!) using \curl -sSL https://get.rvm.io | bash -s stable
Ensure that RVM knows about homebrew through the autolibs option using rvm autolibs homebrew
Setup the environment variables so that we know where the openssl is installed:
export LDFLAGS=-L/usr/local/opt/openssl/lib
export CPPFLAGS=-I/usr/local/opt/openssl/include
export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig
Install ruby via rvm install 2.3.3 --autolibs=homebrew
Check that it Works
Check that the rvm space knows about the OpenSSL certificates using rvm osx-ssl-certs status all. Running this command produced the following output: Certificates for /usr/local/etc/openssl/cert.pem: Up to date.
Install rails via gem install rails
At the last step the installation succeeded and Rails was working (at last!)
If that doesn't work for another reader -
try this:
rvm get branch /bugfix/3923_set_osx_brew_openssl_compiler_config
rvm install 2.4.0
If that works for you, go to the rvm issue and tell the developer how much you appreciate his effort :)
I have the error below when installing rails on osx maverick. OpenSSL has been installed already. Does anyone know how to fix this issue?
$ gem install rails
ERROR: While executing gem ... (Gem::Exception)
Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources
You may need to update your OpenSSL CA Bundle, per these instructions from chruby about Ruby 2.1.2 which state:
Install 2.1.2
Note: MRI 2.1.2 requires OpenSSL >= 1.0.1.
wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.bz2
tar -xjvf ruby-2.1.2.tar.bz2
cd ruby-2.1.2
./configure --prefix=/opt/rubies/ruby-2.1.2
make
sudo make install
Note: OS X users must update their OpenSSL CA cert bundle and properly set ./configure --with-opt-dir to compile against Homebrew's libraries:
wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.bz2
tar -xjvf ruby-2.1.2.tar.bz2
cd ruby-2.1.2
./configure --prefix="$HOME/.rubies/ruby-2.1.2" --with-opt-dir="$(brew --prefix openssl):$(brew --prefix readline):$(brew --prefix libyaml):$(brew --prefix gdbm):$(brew --prefix libffi)"
make
sudo make install
For me, it was enough to just update my OpenSSL CA cert bundle via Homebrew and then reinstall Ruby using ruby-install
brew tap raggi/ale
brew install openssl-osx-ca
ruby-install ruby 2.1.2
After I performed the above steps, the issue stopped presenting itself.
For me... I had tried installing ruby 2.1.2 with ruby-install (since I use chruby for my ruby version manager). I had tried manually installing openssl with homebrew, etc. But I still couldn't get ruby-install to successfully build ruby 2.1.2. I've also had similar issues in the past with installing rubies and ruby-build worked then so I gave I gave it a shot here and it worked! As I understand it, ruby-build is the installer used by rbenv.
What I did was:
rm -rf ~/.rubies/ruby-2.1.2 (This is where my ruby installs are installed at.)
brew remove --force openssl
brew install ruby-build
restart console to be safe
ruby-build 2.1.2 ~/.rubies/ruby-2.1.2
And success! ruby-build seems to be much smarter than ruby-install at successfully installing weird dependencies. I'm done with ruby-install at this point -- it's given me too many problems! (brew remove --force ruby-install)
I've had a similar issue.
A fix to rvm was introduced just yesterday, and it was not yet merged with rvm master branch, so this is how you do it:
rvm get branch /bugfix/3923_set_osx_brew_openssl_compiler_config
rvm install 2.4.0
gem install rails
If that works for you, go to the issue and tell the developer how much you appreciate his effort:
Recently I was struggling with ruby installations due to the recent auto-update in openssl version from 1.0 to 1.1.
I found out that the ruby version < 2.4 does not work with openssl version > 1.0.
I was not even able to revert back the openssl to 1.0 version because other libs has dependencies on it.
No other solution except the one given below 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
Now my ruby runs with openssl 1.0 whereas all other libraries are running on the default openssl version 1.1.
secure server is the reason of this issue. You can Install it by using this command:
gem install rails --source http://rubygems.org
by default its using https://rubygem.org as the source for the gem.
$ gem install rails ERROR: While executing gem ... (Gem::Exception) Unable to
require openssl, install OpenSSL and
rebuild ruby (preferred) or use non-HTTPS sources
so we can specify a source, http//:rubygems.org which is a non-HTTPS source.
I would like to install Ruby 2.0 with RVM on my Ubuntu system and get an error message:
rvm 1.23.5 (master)
ubuntu 12.04 (LTS)
**---- Error message: -------**
rvm install 2.0.0
Searching for binary rubies, this might take some time.
Checking requirements for ubuntu.
Installing requirements for ubuntu.
Updating system.....................................................................................................................................
Error running 'requirements_debian_update_system ruby-2.0.0-p247',
please read /home/emzett/.rvm/log/1381812161_ruby-2.0.0-p247/update_system.log
Requirements installation failed with status: 100.
Update the system using:
sudo apt-get update
Try:
rvm remove 2.0.0 # uninstall rvm
rvm get head --autolibs=3 # get the latest RVM and build required libs
rvm requirements # check if there are any dependencies that need to be installed.
rvm install ruby-2.0.0
I solved the problem by editing
etc/apt/source.list.d/medibuntu.list
I just commented the line referring to medibuntu out.
https://gist.github.com/pcjpcj2/5443017
I recommend this gist.
if you need Ruby on Rails 4.0 ~ , best answer is here
I had the same issue. I ran the following command to fix it:
sudo apt-get -f install
Then I remembered that I failed installing a package earlier that day. What this command did was resolve the dependencies on that package and allowed RVM to do its thing.
This happens when there are broken sources in /etc/apt/sources.list.d or /etc/apt/sources.list.d
You can run Ubuntu Software update to see if there are any any failures due to broken sources, if so, follow the below steps
fix them or comment and execute the following steps
rvm requirements -- this will install all of
the required software modules
rvm list -- provides you the available versions of ruby
rvm install ruby-x.x.x -- This will install x.x.x version of ruby, please change the ruby-x.x.x with the version you are interested in ex (ruby-2.1.0 for 2.1.0 version of ruby)