When working with Flutter and managing different versions using FVM, setting up CocoaPods can present a challenge. This guide provides a straightforward approach to installing CocoaPods for a specific Flutter version managed by FVM.
Prerequisites
- Ensure FVM is installed, and a specific Flutter version is set for your project.
Installing CocoaPods with FVM
-
Determine the Path: Identify the path to the bin directory of the specific Flutter version managed by FVM. For instance, if you are using Flutter version 3.10.4, the path might look like this:
/Users/<your-username>/fvm/versions/3.10.4/bin
. -
Install CocoaPods: Utilize the identified path to install CocoaPods as follows:
sudo gem install -n /Users/<your-username>/fvm/versions/3.10.4/bin cocoapods
-
Navigate to Your Project's iOS Directory
cd <your-project-directory>/ios
-
Install the Pods
pod install