Unable to build Ruby 2.1.3 on OSX 10.10 GM 3.0 with rbenv
The Homebrew package for gcc on Yosemite seems to be broken. That's why it doesn't work.
Had the same issue. Running:
CC=/usr/bin/gcc rbenv install 2.1.3
worked for me. 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. Installing Ruby with rbenv on Arm Mac (M1 Chip) giving errors
Moving away from 2.6.6
to 2.7.6
seemed to have worked! So rbenv install 2.7.6
is what it came down to. In any case, 2.6.6
seemed to have some security issues, so better to update.
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.
Related Topics
Should I Delete Migration After Rollback
Easiest Way to Convert "A/B/C" to ["A/B/C", "A/B", "A"]
Current Password Can't Be Blank When Updating Devise Account
Static Page Routing in Sinatra (Ruby)
How to Write (Large) Files with Ruby Eventmachine
Generate Models from Existing Tables Using Rails 3
Using Rails Form Helpers with Serialized Custom Classes
How Does The "#Map(&Proc)" Idiom Work When Introspecting Module Classes
Paperclip and Amazon S3 How to Do Paths
Deleting Items from an Array Requires Multiple Passes to Remove Them All
Loading/Unloading/Updating Class in Ruby
Get Value from String Representing Local Variable
How to Fix Difference in Behavior of Activesupport 3.0.0 Compare to 2.X