Facing issues with cocoapods, flutter integration, and pod install
2 min readApr 27, 2023
I found some issues while running pod install
. Looks like recently there have been changes to Ruby APIs. This was causing pod install to not work. I tried multiple things and here is the resolution:
- Make sure your ruby version is 3.1.2; you can check with
ruby -v
. You can also userbenv
to manage different ruby versions on your machine, it can be installed via brew. You can dorbenv init
and append the output to your shell rc file.rbenv install 3.1.2
to install ruby 3.1.2, thenrbenv global 3.1.2
to enable ruby 3.1.2 system-wide. - Your cocoapods version should be 1.11.2, you can check with
pod — version
.
a. If in case you don’t have this version, you can uninstall the current version. First, check which package manager was used to install it, you can check withwhich pod
if it is inside brew, uninstall it withbrew remove cocoapods
. Otherwise, you might have installed it via gem; in that case, you can uninstall it viagem uninstall cocoapods
b. Then install it usingsudo gem install -n /usr/local/bin cocoapods -v 1.11.2
- If you also have flutter integrated into your iOS project via cocoapods, you might be getting an error
[!] Invalid `Podfile` file: undefined method `exists?’ for File:Class.
In that case, open yourpodhelper.rb
file. Location for podhelper.rb would be something likepath/to/flutter-sdk/.ios/Flutter/podhelper.rb
and replacereturn [] unless File.exists? file_path
withreturn [] unless File.exist? file_path
The above changes should be able to resolve all your issues related to pod install