ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0 directory.
Trouble installing cocoapods on MacOS Monterey
I can’t help you on the CocoaPods side of things — for that I recommend that you escalate this via their support channel — but I can explain the file system behaviour you’re seeing. The Ruby framework, /System/Library/Frameworks/Ruby.framework, is on the signed system volume and can’t reasonably be modified [1]. For more background on this, see the Signed system volume security in iOS, iPadOS, and macOS section of Apple Platform Security.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] It is possible to modify it if you lower the system security enough but that’s not something that normal folks, even developers, should be doing.