Was trying to setup Android Studio and flutter on my Intel Mac. Did not face this issue when using the Apple silicon Mac.

Actual Error Message
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.

Console output for install activesupport -v 6.1.7.3
Step 2: Install cocoapods
Next I proceed with the installation of cocoapods:
sudo gem install cocoapods

Message after successful installation of cocoapods
Step 3: Rerun Flutter doctor

After rerunning flutter doctor, all looks good!
![Flutter doctor error –[!] Xcode – develop for iOS and macOS (Xcode 14.3.1)Flutter doctor error –✗ CocoaPods not installed](/2023/06/12/flutter-doctor-error-xcode-develop-for-ios-and-macos-xcode-14-3-1flutter-doctor-error--cocoapods-not-installed/Artboard-1024x538-1.webp)