OpenSSL error installing ruby 2.0.0-p195 on Mac with rbenv
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.
error installing ruby old version 2.0.0-p247
Ruby 2.0.0 is very much past its end of life, so I'm assuming you have a specific reason you need install it. Otherwise, you are much better off installing a modern, supported version such as 2.7.x or 3.0.x.
Older versions of ruby were built with openssl@1.0
. After 1.0 went end of life, ruby-build
had a breaking change to require openssl@1.1
. This means that ruby versions < 2.4 can no longer be installed/built directly using ruby-build (i.e., rbenv). This GitHub issue has details.
Homebrew has removed its openssl@1.0
formula, but you can still install it via an rbenv tap. The following might work for you, though the comments in the issue report mixed results depending on the version of Command Line Tools being used.
brew install rbenv/tap/openssl@1.0
RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.0)" 2.0.0-p247
Note: if you are running on an M1 (Apple Silicon) Mac, you might be out of luck. AFIK, there's no intention of getting openssl@1.0 to to work on Apple Silicon.
Ruby 2.6.0 installation fails on MacOS with rbenv
Reposting my response from this other thread - I was facing a similar issue and can recommend the approach below that's related to binutils needing to be uninstalled first. What worked for me:
brew uninstall binutils
# Uninstalling /usr/local/Cellar/binutils/2.33.1... (134 files, 167.6MB)
rbenv install 2.6.5 && rbenv local 2.6.5 ;
# Downloading openssl-1.1.1d.tar.gz...
# -> https://dqw8nmjcqpjn7.cloudfront.net/1e3a91bc1f9dfce01af26026f856e064eab4c8ee0a8f457b5ae30b40b8b711f2
# Installing openssl-1.1.1d...
# Installed openssl-1.1.1d to /Users/auser/.rbenv/versions/2.6.5
# Downloading ruby-2.6.5.tar.bz2...
# -> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.5.tar.bz2
# Installing ruby-2.6.5...
# ruby-build: using readline from homebrew
# Installed ruby-2.6.5 to /Users/auser/.rbenv/versions/2.6.5
Prior to this the I was also getting a number of varying messages in ruby-build.log - with the last being:
# ld: symbol(s) not found for architecture x86_64
A number of other steps that I took as part of my homebrew setup (prior to uninstall) included:
brew install perl ruby rbenv
# // UPDATE PATHs with suggestions made by brew during install
which awk perl
# /usr/local/bin/awk
# /usr/local/bin/perl
# ^^^ IN SHORT ALL PATHs should be with /usr/local/opt OR /usr/local/bin
You can re-install binutils again after as needed and remember to repeat the uninstallation with any future rbenv install
version(s) that you're likely to re-execute (note to self).
PS - tested on macOS Catalina 10.15.3 (19D76) successfully installing both 2.4.0 & 2.6.5
rbenv install 2.7.1 fails on Mac OS Catalina using home-brew
So what I ended up doing was I installed the entire Xcode package found online instead of through the App Store. Doing this helped solve my issue.
Installing ruby-2.1.2: Cannot load such file -- openssl (LoadError)
Ruby <2.4 is incompatible with OpenSSL 1.1 (e.g see https://github.com/rbenv/ruby-build/issues/1353).
Just a hunch, but if you're using Mac + Homebrew, OpenSSL 1.0 was recently deleted, so anything along the lines of brew upgrade openssl
would trash that.
There are several options to deal with this:
- I have older Rubies via
asdf
installed with LibreSSL (which may be safer anyway, see https://security.stackexchange.com/questions/112545/what-are-the-main-advantages-of-using-libressl-in-favor-of-openssl):
$ openssl
OpenSSL> version
LibreSSL 2.8.3
- Compile and link your own OpenSSL 1.0 (or then set compiler flags as environment variables when building Ruby -- https://rvm.io/rubies/installing)
- See if your system's package manager allows you to access openssl 1.0 and install with that (was helping a coworker with this recently and we weren't able to find a good keg for homebrew at this time, unfortunately)
There might be something less convoluted than that; if someone has ideas, please feel free to comment or give an alternate answer.
EDIT
I personally ran into this issue with some other software and discovered that this fixed it, since the old SSL version was sitting around still:
brew switch openssl 1.0.2s
Should work so long as Homebrew doesn't "helpfully" clean that out for me.
Related Topics
Rails 4 Strong Parameters Failing When Creating Instances in Rails Console
Convert a Partial to Method/Block for Speed
How to Deal with Ruby 2.1.2 Memory Leaks
How to Run a Simple File on Heroku
Dealing with Large CSV Files (20G) in Ruby
Connecting to Oracle Db Using Ruby
Simple Neural Network Can't Learn Xor
Write a Migration with Reference to a Model Twice
List Dynamic Attributes in a Mongoid Model
Accessing Nested Model Attributes Inside a Fields_For Without Using Formbuilder
Ruby on Rails Webpacker Can't Find Images Under Asset_Pack_Path
Why Doesn't "Case" with "When > 2" Work
How to Remove a Non-Breaking Space in Ruby
Ruby Select and Reject in One Method
Whenever Gem: I Set :Output But the Logfile Doesn't Show Up Where I'D Expect It To