When I tried to install ruby2.6.6 on my mac using rbenv, I got a "Builed Failed" message.
Initially, I ran it as follows
% rbenv install 2.6.6
Downloading ruby-2.6.6.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.6.tar.bz2
Installing ruby-2.6.6...
ruby-build: using readline from homebrew
BUILD FAILED (macOS 12.0 using ruby-build 20210825)
Inspect or clean up the working tree at /var/folders/zs/rjdwp8ws5_s4gjd40lj1q2gr0000gn/T/ruby-build.20210912210429.75083.Uqwy5z
Results logged to /var/folders/zs/rjdwp8ws5_s4gjd40lj1q2gr0000gn/T/ruby-build.20210912210429.75083.log
Last 10 log lines:
checking build system type... x86_64-apple-darwin13.4.0
checking host system type... x86_64-apple-darwin13.4.0
checking target system type... x86_64-apple-darwin13.4.0
checking for x86_64-apple-darwin13.4.0-clang... (cached) x86_64-apple-darwin13.4.0-clang
checking for x86_64-apple-darwin13.4.0-gcc... (cached) x86_64-apple-darwin13.4.0-clang
checking whether the C compiler works... no
configure: error: in `/var/folders/zs/rjdwp8ws5_s4gjd40lj1q2gr0000gn/T/ruby-build.20210912210429.75083.Uqwy5z/ruby-2.6.6':
configure: error: C compiler cannot create executables
See `config.log' for more details
make: *** No targets specified and no makefile found. Stop.
As you can see in the output, "checking whether the C compiler works... no", I thought the compiler was not working properly and looked for a solution.
There is a solution to run it by specifying the GCC path, and I used that as a reference to run it as follows.
CC=/usr/bin/gcc rbenv install 2.6.6
However, the result was "Build Failed".
The version of gcc is as follows
%gcc --version
Configured with: --prefix=/Applications/Xcode-beta.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 13.0.0 (clang-1300.0.29.3)
Target: x86_64-apple-darwin21.1.0
Thread model: posix
InstalledDir: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
The output and log when the path of gcc is specified are as follows.
% CC=/usr/bin/gcc rbenv install 2.6.6
CC=/usr/bin/gcc rbenv install 2.6.6
Downloading ruby-2.6.6.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.6.tar.bz2
Installing ruby-2.6.6...
ruby-build: using readline from homebrew
BUILD FAILED (macOS 12.0 using ruby-build 20210825)
Inspect or clean up the working tree at /var/folders/zs/rjdwp8ws5_s4gjd40lj1q2gr0000gn/T/ruby-build.20210912211846.75422.XoStEO
Results logged to /var/folders/zs/rjdwp8ws5_s4gjd40lj1q2gr0000gn/T/ruby-build.20210912211846.75422.log
Last 10 log lines:
transform_mjit_header: SKIPPED to transform __inline_isinff
transform_mjit_header: SKIPPED to transform __inline_isfinitel
transform_mjit_header: SKIPPED to transform __inline_isfinited
transform_mjit_header: SKIPPED to transform __inline_isfinitef
transform_mjit_header: SKIPPED to transform __darwin_fd_clr
transform_mjit_header: SKIPPED to transform __darwin_fd_set
transform_mjit_header: SKIPPED to transform __darwin_fd_isset
transform_mjit_header: SKIPPED to transform __darwin_check_fd_set
transform_mjit_header: SKIPPED to transform __sputc
ln -sf ../../../.ext/include/x86_64-darwin13/rb_mjit_min_header-2.6.6.h include/ruby-2.6.0/x86_64-darwin13/rb_mjit_min_header-2.6.6.h
I thought gcc was not compiling properly, so I tried reinstalling it using homebrew, but it did not work.
I'm having trouble finding a solution to this problem. If anyone can tell me what to do, I'd appreciate your response.