[iOS] CocoaPods cheatsheet

Published: (February 5, 2026 at 09:37 PM EST)
1 min read
Source: Dev.to

Source: Dev.to

Introduction

CocoaPods is a dependency manager for iOS projects.

Installation

brew install ruby
sudo gem install cocoapods

Verify the installation:

pod --version

Initialising a Podfile

Navigate to the folder containing your .xcodeproj and run:

pod init

Edit the generated Podfile (Ruby DSL) to specify the platform, target, and desired pods:

platform :ios, '15.0'

target 'YourAppTarget' do
  use_frameworks!

  pod 'Alamofire'
  pod 'SnapKit'
end

Installing Pods

pod install

🚨 From now on, open the .xcworkspace file, not the .xcodeproj.

Example usage

import Alamofire

AF.request("https://example.com").response { response in
    print(response)
}

If the code compiles, you’re all set.

Common CocoaPods Commands

CommandDescription
pod installInstall the dependencies listed in the Podfile.
pod updateUpdate the installed dependencies to the latest compatible versions.
pod repo updateRefresh the local specs repository.
pod deintegrateRemove CocoaPods from the project completely.
pod search NAMESearch for a pod by name.

Troubleshooting

  • “No such module” or Build settings conflicts

    pod deintegrate
    pod install
  • Slow installs

    pod install --repo-update

When to Use CocoaPods

  • Legacy projects that already rely on CocoaPods.
  • Libraries that do not yet support Swift Package Manager (SPM).

For newer projects, consider using Swift Package Manager instead.

Back to Blog

Related posts

Read more »