CocoaPods installed but not working (need to upgrade ruby?)

Brand new Mac mini (I want to start dabbling in iOS app dev). Freshly updated to Sequoia 15.5 then installed Xcode 16.4. Then CocoaPods, flutter 3.32.0, visual studio code with the flutter extension, all following the install instructions. I got to the part to run ‘flutter doctor’ and I see:

[!] Xcode - develop for iOS and macOS (Xcode 16.4) [735ms]
Xcode at /Applications/Xcode.app/Contents/Developer
Build 16F6
CocoaPods installed but not working.
You appear to have CocoaPods installed but it is not working.
This can happen if the version of Ruby that CocoaPods was installed with is different from the one being used to invoke it.
This can usually be fixed by re-installing CocoaPods.
For re-installation instructions, see CocoaPods Guides - Getting Started

Did as instructed, but no luck, the problem persists. One thing I’ll note in retrospect is that during the CocoaPods install, I kept running into dependencies that wanted specific downgraded versions, which basically started with “your version of ruby is too old”. This problem seems to have started with Sequoia coming stock with an older version of ruby.:

ruby -v
ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.x86_64-darwin24]

I’m wondering if flutter, CocoaPods, etc, need a newer version of ruby. But I read elsewhere that updating ruby on Mac is not advised because it can break other things, which gave me pause. Does getting flutter and dependencies working require a particular minimum version of ruby so I should just go for it and try again?

Final detail that may be relevant:
gem which cocoapods
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.16.2/lib/cocoapods.rb
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.16.2/lib/cocoapods.rb