visit
The difference between pod install
and pod update
is subtle, and it isn’t always clear which you should use. But having a good understanding of what these commands do gives you much finer control over how dependencies are managed in your project, so it’s worth knowing the difference.
In the first part of this article I’ll give you a list of recipes showing whether you should run pod install
or pod update
in some common situations. Then in the second part I’ll explain why the different commands do different things, and how CocoaPods uses the Podfile.lock
file to make it all happen.
For these recipes to work, ensure that Podfile
and Podfile.lock
are committed to source control.
pod install
This will install the latest version* of each of the pods you specified in your new Podfile. It will also create a _MyProject_.xcworkspace
file if one didn’t already exist.
pod install
If you were to run pod update
instead, it would install the new pods and update each of your existing pods to its latest version*.
pod update
pod update _SomePod_
pod update _MyDevelopmentPod_
pod install
This will install all pods in the Podfile at the exact versions that were previously installed in this cut of the source code.
If you were to run pod update
instead, it would install the latest version* of each of the pods in the Podfile. This could prevent the project from building if the latest versions weren’t compatible with other code in the project. I’d recommend running pod install
to get the code building, then updating pods as necessary in a controlled manner.
pod install
This will install all pods in the Podfile at the exact versions that were installed in the version being built. This is important for a stable build, because these are the versions that the code was developed against, and it means that every build of that cut of code will use the same pod versions. If you were to use pod update
instead, your build could potentially use different versions of pods each time it builds.
Delete the /Pods
directory, then run pod install
Sometimes people suggest deleting the /Pods
directory and thePodfile.lock
file, then running pod install
. This will solve any issues with Xcode, but will also upgrade each of the pods in the Podfile to its latest version*.
The difference between pod install
and pod update
lies in how they interact with the Podfile.lock
file. This file is used to store the exact version of each pod that is currently installed in your project.
The easiest way to understand how it works is to look at the following diagram (disclaimer: this is a simple schematic rather than an accurate technical diagram).
pod update
ignores Podfile.lock
when checking for versions. It looks for the the latest available version* of a pod, and installs it if it isn’t already installed.
pod install
looks in Podfile.lock
first when checking for versions. If a version of the pod is listed in Podfile.lock
, it will install that exact version. If that pod isn’t listed in Podfile.lock
(or if Podfile.lock
doesn’t exist yet), it will behave as for pod update
, i.e. it finds the latest available version* and installs it.
In both cases, CocoaPods then updates Podfile.lock
with any new version numbers that were installed.
This is what allows you to use pod versions consistently across different installs of a project (i.e. when installing from a repository, across multiple team members, or on a build server), and is why Podfile.lock
should be committed to source control.
In this article I’ve given recipes showing whether to run pod install
or pod update
in a number of common situations. I’ve then described how and why the two commands work in different ways. If you’ve found it useful, please give it a clap and / or share, and follow me for other useful articles.
[*] By latest version I mean latest version that satisfies the requirements and dependencies in your Podfile. See the section on Specifying pod versions in the official guide to for more information.
Gabrielle is an iOS specialist who leads technical teams creating mobile apps. For app development and more, please contact her at (formerly Control F1), look her up on or say ‘hi’ on twitter at .