Facing issues with cocoapods, flutter integration, and pod install
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 use
rbenvto manage different ruby versions on your machine, it can be installed via brew. You can do
rbenv initand append the output to your shell rc file.
rbenv install 3.1.2to install ruby 3.1.2, then
rbenv global 3.1.2to 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 with
which podif 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
- 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.rbfile. Location for podhelper.rb would be something like
return  unless File.exists? file_pathwith
return  unless File.exist? file_path
The above changes should be able to resolve all your issues related to