(resolved) Issues installing cocoapod for Flutter due to outdated rubygems

I’ve been following the Flutter install doc at Make iOS apps | Flutter.

When trying to install cocoapod using “sudo gem install cocoapods”, I get that “the last version of (SOME APP; VARIES) to support your Ruby & RubyGems was (VERSION). … (SAID APP) requires Ruby version >= 3.1.0. The current ruby version is 2.6.10.210.”

So I thought I should update rubygems.

At rubygems.org, “gem ‘algolia’, ‘~> 3.15’, ‘>= 3.15.4’” is not recognized in Terminal (“unknown command algolia”). If I go straight to “gem install algolia” I get the first error again.

Any help would be appreciated.

Update: resolved

Use ruby — Homebrew Formulae.

MacOS come with an old version of ruby. Brew will allow you to install the most recent one and also override the default one (there are instructions after you install it)

Although I never had issues with that approach, an alternative option would to use a ruby version manager, such as rbenv: Easy way to change Ruby version in Mac, M1, M2 and M3 - DEV Community

And, for the record, ruby sucks.

1 Like

Sorry, I meant to update my post yesterday. Yes, it turned out Ruby first and foremost needed updating. I installed the newest Ruby version using Homebrew (I read I shouldn’t interfere with the Ruby installation that came with macOS), and then updated Algolia and installed cocoapods without issue.