How to Install Podfile in Xcode Project?

Updated 29 November 2023

Save

Dear Folks, I hope you are doing well. Sometimes a developer is required a third-party library to use inside the Xcode project, such as Alamofire, SDWebView etc.

The developer uses the dependency manager (Cocoapod or Carthage) to inject the library into the project. Here I going to explain about Cocoapod.

CocoaPods allows developers to easily integrate 3rd party libraries/frameworks into their projects without the need to manually download each library into your project and constantly check for updates individually.

Install CocoaPods in macOS

Before proceeding further, you must install Cocoapod on your Mac System. You can use the below commands in the terminal to check whether your system has CocoaPod or not.

If your system has a pod installed, you will see the Cocoapod version like below.

If you have not installed it yet, you can follow the below steps to install:

Open terminal and type:

Just wait for a successful installation. After installation, you can check for the pod version through the above command in the terminal. If it is showing the version, you are ready to move further steps.

Let’s get started.

Assuming you have a working Xcode project and you have CocoaPods installed via terminal. Generally, a developer delivers a zip file of the XCode project.

Extract the project anywhere in your system. Open your terminal and type the command cd to change the directory path to the project path, give a single space after the cd command.

After this drag the project path to the terminal window like below, then press enter. You can now see the complete path of the project in the terminal.

install Podfile in XCode Project (1)

Type the below command to remove the Podfile.lock file from the project directory. Without removing this file cocoapod will not allow you to install the pod libraries.

Now finally install the pod libraries using the below command. The installation process will be started.

Pod installation complete (1)

After a successful installation, the message “Pod installation complete!” will appear in the terminal.

From now on, open and work with .xcworkspace instead of .xcodeproj. In the above example, you can see the DummyProject.xcworkspace file to launch the project.

CocoaPods Xcode Project Install

For more information regarding CocoaPod refer following links:

If you have any doubts regarding this article, just leave a comment below. Thanks for reading.

author
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Start a Project


    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home