rbenv install ruby BUILD FAILED
There seems to be a problem with the Homebrew package "readline".
brew uninstall readline
brew install https://raw.githubusercontent.com/Homebrew/homebrew/0181c8a1633353affefabe257c170edbd6d7c008/Library/Formula/readline.rb
brew pin readline
Then retry installing ruby with
rbenv install 2.0.0-p0
Answer found thanks to https://github.com/sstephenson/rbenv/issues/579#issuecomment-41122071
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: BUILD FAILED (macOS 11.2 using ruby-build 20210119) Mac Big Sur
This is not an official solution. I'm sure the rbenv devs are working on an actual solution but this workaround should help others who are setting up their ruby environments on the new M1 chips for Mac.
Make sure your Terminal is using Rosetta. You can find how to do that using Google.
Uninstall your current
rbenv
following these instructions Removing rbenv. Be sure you also remove all the downloaded versions of ruby if you have any (minus the system default) located in/Users/<your user name>/.rbenv/versions/
.Uninstall the ARM version of Homebrew with:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
Install the x86_64 version of Homebrew with:
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
If you run
brew install rbenv
should produce output saying "Error: Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)!". This is expected.You want to tell brew to install the older architecture x86_64
arch -x86_64 brew install rbenv
Then finally install the version you want using
arch -x86_64 rbenv install x.x.x
(x = some number i.e. 2.7.2)
From there you just need to remember to tell brew arch -x86_64
when installing other versions of Ruby.
Once an actual fix comes through you'll be able to switch back to the newer architecture and not have to use the arch
argument. You also don't have to do this all the time with brew either, just rbenv.
Related Topics
Ruby 2.7 Says Uri.Escape Is Obsolete, What Replaces It
Splitting String into Pair of Characters in Ruby
How to Parse a Url and Extract the Required Substring
How to Send an Http Put Request in Ruby
Convert a String of 0-F into a Byte Array in Ruby
Authlogic and Multiple Sessions for the Same User
Ruby: Method Inexplicably Overwritten and Set to Nil
How to Execute Windows Cli Commands in Ruby
If 'Main' Is an Instance of 'Object', Why Can't I Call It
"Msvcrt-Ruby18.Dll Was Not Found" with Ruby
How to Read Files in an Eventmachine-Based App
What Does ["String"].Pack('H*') Mean
Installing Rmagick Gem -- Can't Find Magickwand.H
Set Locale Automatically in Ruby on Rails
Ruby Converting String Encoding from Iso-8859-1 to Utf-8 Not Working
How to Use a Ruby Block to Assign Variables in Chef Recipe
Cannot Load Such File -- MySQL2/2.4/Mysql2 (Loaderror) - Windows