Facing issues with cocoapods, flutter integration, and pod install

Abhinav Mallick
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:

  1. Make sure your ruby version is 3.1.2; you can check with ruby -v. You can also use rbenv to manage different ruby versions on your machine, it can be installed via brew. You can do rbenv init and append the output to your shell rc file. rbenv install 3.1.2 to install ruby 3.1.2, then rbenv global 3.1.2 to enable ruby 3.1.2 system-wide.
  2. 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 with which pod if it is inside brew, uninstall it with brew remove cocoapods. Otherwise, you might have installed it via gem; in that case, you can uninstall it via gem uninstall cocoapods
    b. Then install it using sudo gem install -n /usr/local/bin cocoapods -v 1.11.2
  3. 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 your podhelper.rb file. Location for podhelper.rb would be something like path/to/flutter-sdk/.ios/Flutter/podhelper.rb and replace return [] unless File.exists? file_path with return [] unless File.exist? file_path

The above changes should be able to resolve all your issues related to pod install

--

--