CocoaPods cannot see a pod that lives in a private spec repo
Your error
Unable to find a specification for `PrivateSpec` depended upon by `PrivateClientSpec`2 more lines it can showFix it fast
Most common cause, 1 of 4The Podfile has no source line for the private spec repo
Declare the private repo and the official CDN at the top of the Podfile.
# Podfile
source 'https://github.com/my-org/Specs.git'
source 'https://cdn.cocoapods.org/'Short answer
Unable to find a specification for `PrivateSpec` depended upon by `PrivateClientSpec` means no spec source CocoaPods searched has that pod at all. The Podfile lacks the private source line or dropped trunk, a lint ran against the CDN only, or the local clone predates the pod. Add the source, pass --sources, or run pod repo update. CocoaPods 1.16 to 1.17.
Which cause do you have?
Print the spec repos this Mac knows and the source lines the Podfile declares. The missing pod must sit in one of the declared sources, and its folder must exist in that repo's local copy.
pod repo list
grep -n "^source" Podfile
ls ~/.cocoapods/repos/my-specs/ | grep PrivateSpecThen find the line you see in this list and open its fix:
- 1The Podfile has no source line for the private spec repo
grep finds no source line, or only the CDN one, and the pod named in the error is one of your own - 2The private source was added and the trunk line was left out
The pod in the error is a public one, for example `Alamofire` depended upon by `PrivateClientSpec` - 3pod lib lint or pod spec lint ran against the CDN only
The app installs its pods fine, but linting or pushing PrivateClientSpec fails because PrivateSpec cannot be found - 4The local clone of the private repo is older than the pod
pod repo list shows the private repo, yet its folder has no directory for the pod, typically right after a teammate pushed it
What does the error look like?
Unable to find a specification for `PrivateSpec` depended upon by `PrivateClientSpec`* out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.* not added the source repo that hosts the Podspec to your Podfile.
Cause 1 of 4
The Podfile has no source line for the private spec repo
You seegrep finds no source line, or only the CDN one, and the pod named in the error is one of your own
Check
CocoaPods reports Unable to find a specification for a private pod when the repo that hosts it is not among the Podfile's sources. A Podfile with no source line at all searches only the official trunk, which has never heard of your pod, so the hint list ends with not added the source repo that hosts the Podspec to your Podfile.
grep -n "^source" PodfileFix
Declare the private repo and the official CDN at the top of the Podfile. Sources are global, and their order matters: for a pod that appears in two sources, CocoaPods takes it from the first one listed.
# Podfile
source 'https://github.com/my-org/Specs.git'
source 'https://cdn.cocoapods.org/'Verify
pod install resolves, and the SPEC REPOS section of Podfile.lock now lists the private repo.
pod install
grep -A6 "SPEC REPOS" Podfile.lockConfirmed by guides.cocoapods.org
Cause 2 of 4
The private source was added and the trunk line was left out
You seeThe pod in the error is a public one, for example `Alamofire` depended upon by `PrivateClientSpec`
Check
The official source only counts by default while the Podfile names no source. The Podfile reference puts it plainly: once you specify another source, the official one has to be listed too. Without it, every public dependency of your private pods goes missing.
grep -c "cdn.cocoapods.org" PodfileFix
Add the CDN line next to the private one.
source 'https://github.com/my-org/Specs.git'
source 'https://cdn.cocoapods.org/'Verify
The public pod appears under the trunk entry in Podfile.lock after install.
pod install && grep -A3 "trunk:" Podfile.lockConfirmed by guides.cocoapods.org
Cause 3 of 4
pod lib lint or pod spec lint ran against the CDN only
You seeThe app installs its pods fine, but linting or pushing PrivateClientSpec fails because PrivateSpec cannot be found
Check
Linting a podspec resolves its dependencies from scratch. By default pod lib lint and pod spec lint pull dependent pods from https://cdn.cocoapods.org/ only, so a private dependency is unknown to them. pod repo push differs: it defaults to every repo on the machine.
grep -n "dependency" PrivateClientSpec.podspecFix
Pass both sources, comma separated, to the lint and to the push.
pod lib lint PrivateClientSpec.podspec \
--sources='https://github.com/my-org/Specs.git,https://cdn.cocoapods.org/'
pod repo push my-specs PrivateClientSpec.podspec \
--sources='https://github.com/my-org/Specs.git,https://cdn.cocoapods.org/'Verify
The lint finishes without the error, and after the push the spec has its own folder in the local my-specs clone.
ls ~/.cocoapods/repos/my-specs/PrivateClientSpecConfirmed by guides.cocoapods.org
Cause 4 of 4
The local clone of the private repo is older than the pod
You seepod repo list shows the private repo, yet its folder has no directory for the pod, typically right after a teammate pushed it
Check
A git spec repo added with pod repo add is a clone on your disk. Since CocoaPods 1.0, pod install no longer updates spec repos by itself, so a pod pushed after your last update does not exist locally. That is why the error's list opens with out-of-date source repos.
ls ~/.cocoapods/repos/my-specs/ | grep PrivateSpecFix
Update that one repo, or let the install do the update first.
pod repo update my-specs
# or
pod install --repo-updateVerify
The pod's folder now exists in the clone, and pod install finishes.
ls ~/.cocoapods/repos/my-specs/PrivateSpecConfirmed by raw.githubusercontent.com
How do I stop it coming back?
- Keep the private source and the CDN source together at the top of every Podfile that uses in-house pods, and review both in code review.
- Put the --sources list for lint and push in one shared release script, so nobody types it from memory.
- Run pod install --repo-update in CI jobs that consume private pods, since the build machine's clone is otherwise as old as its last update.
Sources
- CocoaPods guides: Podfile syntax (source)
- CocoaPods guides: private pods
- CocoaPods guides: command-line reference
- CocoaPods source: resolver error hints (resolver.rb, 1.17.0)
- Molinillo source: Unable to find a specification message
- CocoaPods CHANGELOG: pod install stops auto-updating repos (1.0.0.beta.6)
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.