Maaz Zindani

Loading the index…

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

Xcode reports a Swift package product as missing

ErrorMissing package product 'MyLibrary'

Short answer

Xcode could not find a library product of a Swift package at build time. The usual causes are that the package was never resolved or fetched, that the product is not added to the target that imports it, or that the version requirement or repository access stops resolution. Resolve first, then check the target.

  • Applies to Xcode 26, Swift 6, macOS 26
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Resolve the packages from the command line. If resolution itself fails, the message tells you why; if it succeeds, the problem is in the target setup.

    xcodebuild -resolvePackageDependencies -project MyApp.xcodeproj
  2. 2Match what you see, then jump to its fix

    1. 1The Swift Package Dependencies section in the Project navigator is empty or shows the package without contentsThe package was not resolved or fetched yetFix
    2. 2The package resolves, but one target (often an extension or a test target) imports a module it was never linked toThe product is not added to the target that uses itFix
    3. 3The resolve command in the first step prints an error instead of finishingNo available version satisfies the requirementFix

What does the error look like?

  • Missing package product 'MyLibrary'

Cause 1 of 3

The package was not resolved or fetched yet

1Check

Look at the Project navigator under Swift Package Dependencies. Xcode normally resolves and fetches packages on its own, and you can trigger it yourself.

xcodebuild -resolvePackageDependencies -project MyApp.xcodeproj

2Fix

Run the resolve action from the File > Packages menu in Xcode (the same step the command above performs), then build again.

# Xcode: File > Packages > Resolve Package Versions

3Verify

The package expands in the Project navigator and the build no longer reports the product.

xcodebuild -scheme MyApp -destination 'generic/platform=iOS Simulator' build

Confirmed by developer.apple.com

Did this fix it?

Cause 2 of 3

The product is not added to the target that uses it

1Check

Select the target > General > Frameworks, Libraries, and Embedded Content and look for the product. Apple says you select the package's products and add them to targets.

grep -n "productRefGroup\|XCSwiftPackageProductDependency" MyApp.xcodeproj/project.pbxproj

2Fix

Click + under Frameworks, Libraries, and Embedded Content of that target and add the package product.

# target > General > Frameworks, Libraries, and Embedded Content > + > pick the product

3Verify

Build the target that failed.

xcodebuild -scheme MyApp -destination 'generic/platform=iOS Simulator' build

Confirmed by developer.apple.com

Did this fix it?

Cause 3 of 3

No available version satisfies the requirement

1Check

Open the project > Package Dependencies and read the requirement (version range, branch or commit). Apple says the version rule needs packages that follow semantic versioning.

xcodebuild -resolvePackageDependencies -project MyApp.xcodeproj

2Fix

Change the requirement to one that a real release of the package satisfies, and confirm you can reach the repository URL.

# project > Package Dependencies > select the package > Dependency Rule

3Verify

Resolution finishes without errors.

xcodebuild -resolvePackageDependencies -project MyApp.xcodeproj

Confirmed by developer.apple.com

Did this fix it?

How do I stop it coming back?

  • Commit the Package.resolved file so every machine resolves the same versions.
  • Add a package product to every target that imports it, including extensions and test targets.
  • Run the resolve command at the start of CI jobs, before the build.

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?

Projects of mine built on the same technologies:

Related fixes

Mobile apps

InstanceID token() no longer works in a Swift Firebase app

Instance ID calls fail to compile after upgrading Firebase to 8.0.0 or later

Firebase removed the Instance ID dependency from Messaging in 8.0.0, so InstanceID.instanceID() calls no longer belong in a current app.

3 causes, each with a fix

Next step

Want this handled for good?

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