Open In App

How to Install cocoaPods in Flutter?

Last Updated : 01 Jul, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. Cocoapods helps you to manage and incorporate third-party libraries into your project without getting concerned about setting up and configuring your project. 

Steps For Installation of CocoaPods

There are two ways to install cocoapods on your mac:

  1. Using Homebrew
  2. Using Gem  

Note: It is much easier to install Cocoapods on mac using Homebrew than gem.

Installation of CocoaPods using Homebrew

Step 1: Open the terminal on your Mac. 

Note: Before proceeding further, make sure your device has Homebrew already installed.

If you don’t have Homebrew installed, head over to this article: HomeBrew – Installation on MacOS

Step 2: Once you have successfully installed Homebrew, run the following command on your terminal

brew install cocoapods

Ideally, it should look like something as shown below: 

 

Step 3: Cocoapods has been successfully installed on your device. To verify the installation, run “pod –version” which would display the version of cocoapods installed on your device.

Installation of CocoaPods using gem 

Step 1: Open the terminal on your Mac. One simple way to open your terminal is by searching “terminal” in the spotlight. Once the terminal window is opened, run the following command. 

sudo gem update --system

 

CocoaPods is built with Ruby and is installable with the default Ruby available on macOS. The above command ensures that the gem installed on the system is up to date.

Step 2: If you encounter an error saying,

ERROR:  While executing gem ... (Errno::EPERM)
   Operation not permitted @ rb_sysopen - /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/gem

then simply re-run the command.

Step 3: Gem installed on our system should be up to date now. In order to install cocoapods, run the following command on your terminal.

sudo gem install cocoapods 

 

Step 4: If you encounter an error saying,

ERROR: While executing gem … (Gem::FilePermissionError)
           You don’t have write permission for the /usr/bin directory.

run the command given below.

sudo gem install cocoapods -n /usr/local/bin

 

Step 5: You have successfully installed cocoapods on your mac. To confirm the installation run 

pod --version

 

 

additionally, we can run the following command to check if cocoapods is installed correctly or not.

flutter doctor

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads