Unable to install OpenSSL package with RVM on Mountain Lion - ruby

I'm setting up RVM, Rails, etc., on a clean install of Mountain Lion.
I am following the guide "How to Install Xcode, Homebrew, Git, RVM, & Ruby 1.9.3 on Snow Leopard, Lion, and Mountain Lion".
After installing RVM with Ruby (1.9.3) I do a rvm requirement and it appears I should install apple-gcc42 using Homebrew:
Homebrew:
If you are using Homebrew, you can install the apple-gcc42 and required libraries from homebrew/dupes:
brew update
brew tap homebrew/dupes
brew install autoconf automake apple-gcc42
rvm pkg install openssl
When I get to the OpenSSL package install I get the following error and don't know how to proceed:
marvin:~ george$ rvm --skip-autoreconf pkg install openssl
Fetching openssl-1.0.1c.tar.gz to /Users/george/.rvm/archives
######################################################################## 100.0%
Downloaded archive checksum did not match, archive was removed!
If you wish to continue with not matching download add '--verify-downloads 2' after the command.
Please note that it's required to reinstall all rubies:
rvm reinstall all --force
Updating openssl certificates
Error running 'update_openssl_certs', please read /Users/george/.rvm/log/openssl.certs.log
The contents of the specified log file are as below, presumably because the OpenSSL archive has been discarded:
[2012-12-26 22:23:04] update_openssl_certs
/Users/george/.rvm/scripts/functions/support: line 139: cd: /Users/george/.rvm/usr/ssl: No such file or directory

I used hombrew to install opensll.
brew install openssl
If that doesn't work check this link for answers.
http://railsapps.github.io/openssl-certificate-verify-failed.html

Related

How to "recompile Ruby with OpenSSL support" using RVM?

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`

Downgrade to OPENSSL version 1.0 from 1.1 on mac

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

Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources

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

OpenSSL error installing ruby 2.0.0-p195 on Mac with rbenv

I'm trying to install Ruby 2.0.0-p195 using rbenv on a Mac (Mountain Lion) and got this error.
BUILD FAILED
Inspect or clean up the working tree at /var/folders/vt/27n8h2yj27v7rzq58075f3_m0000gn/T/ruby-build.20130618163859.1669
Results logged to /var/folders/vt/27n8h2yj27v7rzq58075f3_m0000gn/T/ruby-build.20130618163859.1669.log
Last 10 log lines:
installing default gems: /Users/me/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0 (build_info, cache, doc, gems, specifications)
bigdecimal 1.2.0
io-console 0.4.2
json 1.7.7
minitest 4.3.2
psych 2.0.0
rake 0.9.6
rdoc 4.0.0
test-unit 2.0.0.0
The Ruby openssl extension was not compiled. Missing the OpenSSL lib?
When I ran brew install openssl it said
Warning: openssl-1.0.1e already installed
Following a solution on this thread https://github.com/sstephenson/ruby-build/issues/305 I tried to install latest stable this way and got the same error
env CFLAGS='-g -O2' RUBY_CONFIGURE_OPTS="--with-readline-dir=`brew --prefix readline`" rbenv install 2.0.0-p195
Any ideas?
Try adding OpenSSL to the config options using the --with-openssl-dir option:
$ CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl`" rbenv install 2.0.0-p195
If you're using Homebrew, you'll need to install OpenSSL before running the above by running:
$ brew install openssl
UPDATE (see #JarkkoLaine 's comment below):
Just for the record, you should not need to use the config opts
anymore with ruby-build and homebrew. However, I had to reinstall
openssl with homebrew to make it work: brew uninstall openssl; brew
upgrade; brew install openssl; rbenv install 2.0.0-p247. See this for
more info.
I fixed this by executing:
brew link openssl --force
Mac OSX 10.9.4
Upgrading to the latest version of ruby-build fixed the problem for me:
Like the OP, I got
BUILD FAILED
Inspect or clean up the working tree at /Users/me/.rbenv/sources/2.0.0-p247
Results logged to /var/folders/3x/y_8y8vr53ws_kxj97km79q5h0000gn/T/ruby-build.20130704172404.3106.log
Last 10 log lines:
installing default gems: /Users/me/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0 (build_info, cache, doc, gems, specifications)
bigdecimal 1.2.0
io-console 0.4.2
json 1.7.7
minitest 4.3.2
psych 2.0.0
rake 0.9.6
rdoc 4.0.0
test-unit 2.0.0.0
The Ruby openssl extension was not compiled. Missing the OpenSSL lib?
but installing the latest version of ruby-build, via
# Don't forget brew doctor and brew update if required
brew upgrade ruby-build
fixed it.
Ruby-build had some changes between when the OP asked and now, which would explain why it worked for me, but not for the OP using the latest stable version of ruby-build.
For those who have problems installing openssl.
I had this error on my Mac 10.8.4
brew install openssl
created directory `/usr/local/Cellar/openssl/1.0.1e/include/openssl'
make: *** [install_sw] Error 13
READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting
These open issues may also help:
https://github.com/mxcl/homebrew/pull/19429
Create a directory if it does not exist
sudo mkdir /usr/local/etc/openssl
Change the rights. Replace and with your name and group (e.g. serge:admin)
sudo chown -R <username>:<group> /usr/local/etc/openssl/
Repeat openssl installation
brew install openssl
Install curl-ca-bundle
brew install curl-ca-bundle
install ruby
CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl`" rbenv install 2.0.0-p195
Bingo
Solution using ruby-install:
After uninstalling and installing openssl a couple of times (probably unnecessary) I successfully tried this:
ruby-install ruby 2.1.3 -- --with-openssl-dir=`brew --prefix openssl`
The missing library is libssl*-dev* / openssl*-dev*, depending your distribution.
This issue came up again for me with Mac OS 10.9.5
Mac upgraded the command-line tools and that upgraded openssl, which broken rbenv.
I tried all of these solutions, but none of them worked. Everything was up-to-date, but I couldn't install any new gems or build rubies.
My solution was to:
Remove the ruby version (for me it was 2.1.1)
Brew uninstall ruby-build and rbenv
Brew Re-install rbenv and ruby-build
Hope this helps you if you encounter it too!

Error installing any ruby version with RVM on OSX

Guys I'm about to kill myself with this one!
I had some problems with RVM installing multiple versions of Ruby, and following a thread on Stackoverflow I decided to remove it completely. After reinstalling RVM, I am unable to install any Ruby version at all.
Mac OS X
RVM 1.20.10 stable
Homebrew 0.9.4
Here are some logs:
rvm install 2.0.0-p0
or:
rvm install 2.0.0-p195 --autolibs=enabled
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.8/x86_64/ruby-2.0.0-p0.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
Installing requirements for osx, might require sudo password.
Already up-to-date.
Installing required packages: autoconf, automake, libtool, pkg-config, libyaml, readline, libxml2, libxslt, libksba, openssl…
Error running 'requirements_osx_brew_libs_install autoconf automake libtool pkg-config libyaml readline libxml2 libxslt libksba openssl',
please read /Users/admin/.rvm/log/ruby-2.0.0-p0/1368903329_package_install_autoconf_automake_libtool_pkg-config_libyaml_readline_libxml2_libxslt_libksba_openssl.log
Logfile reads:
[2013-05-18 22:55:29] requirements_osx_brew_libs_install
Error: No such keg: /usr/local/Cellar/autoconf
There were package installation errors, make sure to read the log.
Check Homebrew requirements github.com/mxcl/homebrew/wiki/Installation
brew doctor
Your system is ready to brew.
brew cleanup
Removing: /Library/Caches/Homebrew/automake-1.13.1.tar.gz…
Error: Permission denied — /Library/Caches/Homebrew/automake-1.13.1.tar.gz
brew reinstall autoconf
Error: No such keg: /usr/local/Cellar/autoconf
Help!
I ran into the same issue, you need to manually install all the required packages using Brew. For me I had to run the following installs:
brew install autoconf
brew install automake
brew install libtool
brew install apple-gcc42
brew install libyaml
brew install libxslt
brew install libksba
brew install openssl
You just need to keep running "rvm requirements" and reading the log and installing the packages needed until there are no more errors.
After installing RVM, You'll want to run
rvm requirements
to see if anything else is required to install ruby and rails first.
here is the similar question asked rvm install ruby
This solved problem for me
sudo chown -R `whoami` /Library/Caches/Homebrew/
I had the same problem
brew install pkg-config
worked for me
I aswell ran into the permission problem. My /usr/local/opt where the packages are linked had permissions root:wheel. I changed permissions by doing
sudo chown -R <localuser>:staff /usr/local/opt
where of course "localuser" is your local user you used to install brew.
Then aswell I had to run
brew reinstall autoconf
and so on instead of just "install", since brew always kept on saying the lib already was installed (yet not linked). "reinstall" simply forces a new install of the package. that did the trick for me.
Hope this helps someone with similar problems.
User which is running brew should have write access to This entire directory path
/Library/Caches/Homebrew/Formula
No need to change ownership just write permission. then running rvm works
I was encountering similar issues, particular around the install of openssl098. I came across this Homebrew issue, tried rvm get head as suggested, and now rvm works perfectly.
I'd try to install Xcode Command Line Tools before.
Try
rvm reinstall ruby-2.3.1 --with-openssl-dir=`brew --prefix openssl`
rvm openssl on Mojave

Resources