Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4791 pages
Flutter and app store releases

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 show

Fix it fast

Most common cause, 1 of 4

The Podfile has no source line for the private spec repo

Declare the private repo and the official CDN at the top of the Podfile.

Fix
# Podfile
source 'https://github.com/my-org/Specs.git'
source 'https://cdn.cocoapods.org/'
Did this fix it?
Full steps for this cause: check, fix, verify

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.

  • Applies to CocoaPods 1.16 and 1.17, git-hosted private spec repos, cdn.cocoapods.org trunk
  • Updated
  • By Maaz Zindani, Senior Software Engineer

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.

Run this first
pod repo list
grep -n "^source" Podfile
ls ~/.cocoapods/repos/my-specs/ | grep PrivateSpec

Then find the line you see in this list and open its fix:

  1. 1The Podfile has no source line for the private spec repogrep finds no source line, or only the CDN one, and the pod named in the error is one of your own
  2. 2The private source was added and the trunk line was left outThe pod in the error is a public one, for example `Alamofire` depended upon by `PrivateClientSpec`
  3. 3pod lib lint or pod spec lint ran against the CDN onlyThe app installs its pods fine, but linting or pushing PrivateClientSpec fails because PrivateSpec cannot be found
  4. 4The local clone of the private repo is older than the podpod 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.

Check
grep -n "^source" Podfile

Fix

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.

Fix
# 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.

Verify
pod install
grep -A6 "SPEC REPOS" Podfile.lock

Confirmed by guides.cocoapods.org

Did this fix it?

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.

Check
grep -c "cdn.cocoapods.org" Podfile

Fix

Add the CDN line next to the private one.

Fix
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.

Verify
pod install && grep -A3 "trunk:" Podfile.lock

Confirmed by guides.cocoapods.org

Did this fix it?

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.

Check
grep -n "dependency" PrivateClientSpec.podspec

Fix

Pass both sources, comma separated, to the lint and to the push.

Fix
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.

Verify
ls ~/.cocoapods/repos/my-specs/PrivateClientSpec

Confirmed by guides.cocoapods.org

Did this fix it?

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.

Check
ls ~/.cocoapods/repos/my-specs/ | grep PrivateSpec

Fix

Update that one repo, or let the install do the update first.

Fix
pod repo update my-specs
# or
pod install --repo-update

Verify

The pod's folder now exists in the clone, and pod install finishes.

Verify
ls ~/.cocoapods/repos/my-specs/PrivateSpec

Confirmed by raw.githubusercontent.com

Did this fix it?

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

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.

Which stack is behind this page?

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.