Guides / iOS and Apple Platform Engineering
What is a private CocoaPod?
A private CocoaPod is a reusable iOS or macOS library packaged with a podspec file and hosted in a private Git repository, so only people with access can install it. The team either publishes the podspec to a private spec repo or points the Podfile straight at the Git repo, then installs it like any public pod. Teams use them to share proprietary code across apps with proper versioning, without putting it on the public CocoaPods registry.
How a private CocoaPod works
CocoaPods is a dependency manager for Apple platform projects. Every pod is described by a podspec: a small file that gives the pod's name, version, source location, source files, minimum OS version and its own dependencies.
A public pod is listed in the shared public specs repository, so anyone can add it to a Podfile. A private pod skips that. The code lives in a Git repo only your team can read, and the podspec is kept either in a private spec repo or not published at all. Access control is just Git permissions.
The usual setup
- Put the library code in its own private Git repo, separate from any app.
- Write a podspec that points at that repo and a version tag.
- Create a second private Git repo to act as your team's spec repo, and register it on each machine with pod repo add.
- Check the podspec with pod lib lint, tag a release, then publish it with pod repo push.
- In the app's Podfile, list your private spec repo as a source, add the public CocoaPods source as well, and declare the pod with a version rule.
- Run pod install and open the generated workspace.
Keep the public source in the Podfile alongside your private one. If you list only the private source, every public pod in the project stops resolving.
The shortcut without a spec repo
For a small team you can skip the spec repo and point the Podfile at the Git URL and a tag. While you are editing the library itself, point at a local path instead. That gives you a development pod, where changes show up in the app without a release. A private pod and a development pod overlap, but they are not the same thing: one describes who can fetch it, the other describes where it is being edited.
Why a team would make one
The main reason is code that more than one target needs but that should not be public. If two apps each carry their own copy of the same networking or device-communication layer, every bug gets fixed twice and the copies drift apart. A private pod makes it one codebase with one version number.
- Reuse across apps. Several apps and extensions pull the same tested code.
- Privacy. Proprietary logic stays behind your Git permissions.
- Versioning. Apps pin a version, so a change in the library does not break an app until the team upgrades on purpose.
- Clear boundaries. A library with a public interface and its own tests is easier to reason about than a folder inside an app target.
- Independent testing. The library can be built and tested without compiling a whole app.
The cost is real. You now maintain a release process for the library, and a change that touches both the pod and an app takes two steps instead of one.
Private pods at Logitech
From July 2017 to September 2021, Nithin Gaddam was a Software Engineer III at Logitech. There he built and maintained the Ultimate Ears Bluetooth and IoT speaker companion iOS apps for the App Store, enabled continuous integration for QA and production builds, and developed 2 private cocoapods.
That mix is typical of where private pods show up. A product line with several companion apps and a build pipeline needs shared code with a stable version and a release process the CI system can follow. The pods' code belongs to Logitech, so this page stays on the general pattern rather than their contents.
If you are working on the app side of that setup, the guide on building a companion app for a Bluetooth speaker covers the app itself.
What CI needs to install private pods
A private pod adds one requirement to every build machine: it must be able to read your private repos. A laptop that already has your SSH key will install the pod without complaint, and then the CI job fails on a clean machine.
- Give the CI runner read access to both the spec repo and each pod repo, using a deploy key or a token.
- Install the pods in the pipeline before the build step, with the same sources listed in the Podfile.
- Commit the Podfile.lock so QA and production builds resolve the same versions every time.
Getting this right is part of removing manual builds. The guide on how to stop manually building iOS apps for QA goes through the build side.
When a private pod is the wrong tool
If only one app uses the code, a separate pod is usually overhead. A folder or a local module inside the app is simpler, and you can extract it later when a second consumer shows up.
Swift Package Manager is the other common way to share internal code, and it can also pull from private Git repos. A team already deep in a Podfile often keeps pods for consistency. A newer project may reasonably start with packages instead. The choice matters less than having a versioned, tested, shared library at all.
Frequently asked questions
Is a private CocoaPod the same as a development pod?
No. A private pod is one whose code and podspec are only available to your team. A development pod is any pod you point at a local folder so you can edit it live, and it can be public or private.
Do private CocoaPods cost money?
CocoaPods itself is free. You only need somewhere to host private Git repos, and whether that costs anything depends on the host and plan your team already uses.
Do I need a private spec repo?
No. You can point the Podfile at the Git URL and a tag. A spec repo is worth it once several apps and people consume the pod and you want normal version rules like a range of allowed releases.
How many private cocoapods has Nithin Gaddam built?
He developed 2 private cocoapods while at Logitech, alongside the Ultimate Ears speaker companion apps and the continuous integration setup for QA and production builds.
Why does my private pod install locally but fail in CI?
The CI machine usually cannot read your private repos. Give the runner a deploy key or token with read access to the spec repo and the pod repos, and make sure the Podfile lists the same sources.