Thanks to @indirect’s help, I’m back up and running.
Turns out there’s that directory /Library/Ruby/Gems/2.6.0/specifications/default
. It contains a couple of gemspecs you really can’t (and shouldn’t ever) delete.
With the default gemspecs back in place, I was able to apply the fiddle hack mentioned below, and got Homebrew working again.
My DTK gives me the dreaded symbol '_ffi_prep_closure' not found
error after I deleted /Library/Ruby
.
The following workaround no longer has any effect for me:
cd "$(mktemp -d)" \
&& git clone https://github.com/ruby/fiddle \
&& cd fiddle \
&& bundle install --path vendor/bundle \
&& bundle exec rake build \
&& sudo gem install pkg/fiddle-1.0.1.gem
Would appreciate any pointers so I can avoid setting up the whole machine from scratch.
Am on Big Sur Beta 3, Xcode 12 Beta 3.
Output of /usr/bin/ruby -rfiddle -e ''
:
Traceback (most recent call last):
4: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
3: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
2: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fiddle.rb:2:in `<top (required)>'
1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin20/fiddle.bundle, 0x0009): symbol '_ffi_prep_closure' not found, expected in flat namespace by '/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin20/fiddle.bundle' - /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin20/fiddle.bundle (LoadError)
Nice one, thanks for sharing!
I've also messed the standard /Library/Ruby instalation and at least in macOS 11.2.1 in M1, I could restore the original files fom:
/System/Library/Templates/Data/Library/Ruby/
Hopefully, Apple won't ship ruby as part of the OS anymore in the next releases...