I know there are many instances of this question. I've done everything in those answers and have gotten nowhere after 4 hours.
I am trying to install a gem on Catalina 10.15.7 and getting the ever-popular
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
with this additional context
ERROR: Error installing ffi:
ERROR: Failed to build gem native extension.
current directory: /Users/bmanica/.chefdk/gem/ruby/2.4.0/gems/ffi-1.13.1/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20200925-10024-qilctf.rb extconf.rb --with-cflags\=-save-temps\=obj\ -o\ tmp/a.o
when invoking the installation via
gem install ffi -- --with-cflags="-save-temps=obj -o tmp/a.o"
to get around Catalina's draconian permissions rules.
I've freshly downloaded XCode and the command line tools:
> xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
> xcode-select -p
/Applications/Xcode.app/Contents/Developer
> ls /Applications/Xcode.app/Contents/Developer
Applications Library Makefiles Platforms Toolchains Tools usr
I've accepted the license at least four times via
sudo xcodebuild -license accept
I've tried
sudo xcode-select -switch /
as Gem installation error: You have to install development tools first suggests. I am not on Windows so the rubyinstaller link does not help me.
Can't Find ffi.h When Installing ffi ruby gem references the exact gem I am trying to install, but as indicated xcode-select --install
is not the answer.
None of the answers in Developer tools issues when installing Ruby gems are helpful either; I have already brew install openssl
and brew install libffi
and have exported the variables it told me to:
> set | grep FLAGS
CPPFLAGS=-I/usr/local/opt/libffi/include
LDFLAGS=-L/usr/local/opt/libffi/lib
> set | grep PATH
PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig
I've also tried the suggestions in How to update Xcode from command line - xcode-select -r
does nothing, xcode-select -s /Library/Developer/CommandLineTools
does nothing, and $ sudo rm -rf /Library/Developer/CommandLineTools
prevents xcode-select --install
from working, and additionally I moved it anyway and redownloaded the command line dmg package from Apple's developer site. Still same problem.
What do I try next to get this gem to install?