Error installing CocoaPods - macOS BigSur
I had the same issue (Catalina 10.15.7 & Xcode 12.3).
I used homebrew instead of the gem:
brew install cocoapods
XCode's ruby framework appears to have a problem. Reinstall Xcode.app cleanly with the latest version and running
xcode-select --install or
--select did not work for me.
This is how I managed to make it run with XCode 12.2 and Catalina (10.15.7): https://stackoverflow.com/a/65481787/1534182
cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby ln -sf ../../../../Headers/ruby/config.h cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0 ln -sf universal-darwin20 universal-darwin19
(edit fixed typo in symlink)