I am running into some trouble installing Ruby 2.2.2 on macOS Big Sur. Has anyone had a similar issue that they were able to resolve? Many thanks 🙏
Error:
`Downloading openssl-1.0.2u.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/ecd0c6ffb493dd06707d38b14bb4d8c2288bb7033735606569d8f90f89669d16
Installing openssl-1.0.2u...
Installed openssl-1.0.2u to /Users/findum/.rbenv/versions/2.2.2
Downloading ruby-2.2.2.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.2.tar.bz2
Installing ruby-2.2.2...
WARNING: ruby-2.2.2 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.
ruby-build: using readline from homebrew
BUILD FAILED (macOS 11.1 using ruby-build 20201225)
Inspect or clean up the working tree at /var/folders/x8/g8yqvrh55gq0wds4hny1t94r0000gn/T/ruby-build.20210101111906.42540.uFRvAN
Results logged to /var/folders/x8/g8yqvrh55gq0wds4hny1t94r0000gn/T/ruby-build.20210101111906.42540.log
Last 10 log lines:
compiling ../.././ext/psych/yaml/parser.c
linking shared-object json/ext/parser.bundle
linking shared-object pathname.bundle
installing default psych libraries
linking shared-object json/ext/generator.bundle
linking shared-object bigdecimal.bundle
linking shared-object psych.bundle
linking shared-object nkf.bundle
linking shared-object date_core.bundle
make: *** [build-ext] Error 2`
The latest version, Ruby 3.1. 2, was released in April 2022, and is a major version upgrade from the one that is preinstalled on the macOS. You'll likely want to use Ruby 3 for a local development environment — which is a very good reason to move away from pre-installed Ruby versions.
ruby-build is a plugin for rbenv that allows you to compile and install different versions of Ruby. ruby-build can also be used as a standalone program without rbenv. It is available for macOS, Linux, and other UNIX-like operating systems.
It looks like OP edited the error in the original message so the below answer is no longer relevant. Leaving it here for posterity.
Based on discussion in a couple of Github issues on the rbenv repo,
it sounds like Apple changed the default CFLAGS
as part of xcode 12, which makes some of the native extension installations go haywire. It sounds like the solution proposed in those issues is
CFLAGS="-Wno-error=implicit-function-declaration" rbenv install 2.2.2
The error states it failed due to issues with extensions
The Ruby readline extension was not compiled.
The Ruby zlib extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
so I would suggest trying to install those extensions manually first, then retrying the ruby install.
With brew:
brew install readline
brew install zlib
There are some issues on ruby-build
's github that might help as well:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With