'Inspect or clean up the working tree when installing Ruby on Mac M1

I'm trying to install Ruby 2.5.1 by running rbenv install 2.5.1 and keep getting the below failure:

BUILD FAILED (macOS 12.0.1 using ruby-build 20211203)

Inspect or clean up the working tree at /var/folders/_n/7rd4p8r578db_ct2rrwhvwv80000gn/T/ruby-build.20211204124341.35704.JFosKp
Results logged to /var/folders/_n/7rd4p8r578db_ct2rrwhvwv80000gn/T/ruby-build.20211204124341.35704.log

Last 10 log lines:
    rb_mObjSpace = rb_const_get(rb_cObject, rb_intern("ObjectSpace"));
                                            ^~~~~~~~~~~~~~~~~~~~~~~~
../.././include/ruby/ruby.h:1755:56: note: expanded from macro 'rb_intern'
        __extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \

Tried everything here and here.

Any ideas what could be causing this?



Solution 1:[1]

Solved it by running $ RUBY_CFLAGS="-Wno-error=implicit-function-declaration" rbenv install 2.5.1

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Cole S