6

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`
Layne Johnson
  • 63
  • 1
  • 5
  • Trying to install using this command: `RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.0)" rbenv install 2.2.2` – Layne Johnson Jan 01 '21 at 16:03
  • I'd suggest inspecting the log file mentioned in the error message /var/folders/x8/g8yqvrh55gq0wds4hny1t94r0000gn/T/ruby-build.20210101111906.42540.log. It might have additional info that could be helpful. – supremebeing7 Jan 03 '21 at 21:13
  • See my updated answer. I don't use rbenv or ruby-build so can't speak to its efficacy. – supremebeing7 Jan 03 '21 at 21:18
  • "*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.*" Do you specifically need Ruby 2.2.2? – Schwern Jan 03 '21 at 21:25
  • Thank you @Schwern ! Yes, I am working on rebooting an older project. Learning how to upgrade to a newer Ruby version :) – Layne Johnson Jan 13 '21 at 15:58

1 Answers1

16

EDIT

It looks like OP edited the error in the original message so the below answer is no longer relevant. Leaving it here for posterity.


Updated Answer

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

Original answer

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:

supremebeing7
  • 1,073
  • 9
  • 26
  • Thank you @supremebeing7! I ran both `brew install readline brew install zlib` but, it looks like they are already installed and up-to-date. I reinstalled both readline and zlib, but still no luck :( – Layne Johnson Jan 01 '21 at 16:02
  • Same error after reinstalling? How about using the commands from the linked github issues, e.g. `RUBY_CONFIGURE_OPTS=--with-readline-dir="$(brew --prefix readline)" --with-zlib-dir="$(brew --prefix zlib)"` – supremebeing7 Jan 03 '21 at 21:08
  • Oh wait, it looks like you updated the error message in your post? – supremebeing7 Jan 03 '21 at 21:09
  • Ah! I am sorry– I am new to Stack Overflow! I should have kept the original error. The original error was with Ruby readline/zlib. Error evolved to current description. `CFLAGS="-Wno-error=implicit-function-declaration" rbenv install 2.2.2` solved the problem! Thank you so much for your help, @supremebeing7 ! – Layne Johnson Jan 13 '21 at 15:41