Let’s reproduce the error first:
- Install Ruby with Rbenv
$ rbenv install 2.7.2
NOTE: In my M1 Mac, I tried installing various ruby versions with Rbenv like 2.5.0, 2.6.0, 2.7.0, 2.7.1, 2.7.2 and always ran into this same issue.
- Install error
You will get the following error message
- BUILD FAILED (macOS 11.2.3 using ruby-build 20210309)
- Inspect or clean up the working tree at
Instead of running the normal ruby install command with rbenv, let’s prepend it with
RUBY_CFLAGS="-Wno-error=implicit-function-declaration", which will suppress all errors and warnings and let the ruby installation complete.
$ RUBY_CFLAGS="-Wno-error=implicit-function-declaration" rbenv install 2.5.0
Tada! See the magic? Ruby should install without any issue now.
Are you using any other method to fix the issue? Let us know in the comments below.
Thank you for reading!