Was trying to setup Android Studio and flutter on my Intel Mac. Did not face this issue when using the Apple silicon Mac.
Steps to resolve:
Step 1: Install active support gem
sudo gem install activesupport -v 6.1.7.3
I have to run the above command as prompted before installing cocoapods as it prompts that my Ruby is outdated.
ERROR: Error installing cocoapods:
The last version of activesupport (>= 5.0, < 8) to support your Ruby & RubyGems was 6.1.7.3. Try installing it with `gem install activesupport -v 6.1.7.3` and then running the current command again
activesupport requires Ruby version >= 2.7.0. The current ruby version is 2.6.10.210.
After successfully executed the command, I see that 2 gems was installed.
Step 2: Install cocoapods
Next I proceed with the installation of cocoapods:
sudo gem install cocoapods
Step 3: Rerun Flutter doctor
After rerunning flutter doctor, all looks good!