Maaz Zindani

Loading the index…

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

pod install: no Xcode target matches a block in the Podfile

Your error

Unable to find a target named `MyApp` in project `MyApp.xcodeproj`, did find `MyApp-iOS`.2 more lines it can show

Fix it fast

Most common cause, 1 of 4

The block name and the Xcode target name differ

Copy the exact name from the did find list into the target block, or rename the Xcode target back.

Fix
# Podfile
target 'MyApp-iOS' do
  pod 'Alamofire'
end
Did this fix it?
Full steps for this cause: check, fix, verify

Short answer

Unable to find a target named `X` in project `Y.xcodeproj`, did find ... means a Podfile target block names something the Xcode project lacks; CocoaPods matches names exactly, case included. The did find list holds the real names. Rename the block, drop a stale test block, use abstract_target for a group, or fix the project line. CocoaPods 1.16 to 1.17.

  • Applies to CocoaPods 1.16 and 1.17, Xcode 26 projects, Flutter iOS Podfile template
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Which cause do you have?

Put the target blocks of the Podfile next to the targets Xcode reports for the project named in the error. The name that is in the first list and missing from the second is the one to fix.

Run this first
grep -n "target '" Podfile
xcodebuild -list -project MyApp.xcodeproj

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

  1. 1The block name and the Xcode target name differThe did find list holds a close variant of the missing name: other case, a suffix such as -iOS, or the name the target had before a rename
  2. 2A nested test or extension block has no target behind itThe did find list contains the app target, and the missing name is a test, widget or extension target such as RunnerTests
  3. 3The block was meant to group pods, not to link a targetThe missing name is a grouping label such as Shared or Common that was never meant to be an app or library target
  4. 4CocoaPods is reading a different .xcodeproj than the one with the targetThe project named in the error is not the one that holds the target, for example an old copy or a library project

What does the error look like?

  • Unable to find a target named `MyApp` in project `MyApp.xcodeproj`, did find `MyApp-iOS`.
  • Unable to find a target named `RunnerTests` in project `Runner.xcodeproj`, did find `Runner`.
  • Unable to find a target named `Shared` in project `MyApp.xcodeproj`, did find `MyApp` and `MyAppTests`.

Cause 1 of 4

The block name and the Xcode target name differ

You seeThe did find list holds a close variant of the missing name: other case, a suffix such as -iOS, or the name the target had before a rename

Check

CocoaPods raises Unable to find a target named when no native target in the project carries exactly the name of the Podfile block. The comparison is a plain, case-sensitive string match with no fallback, so renaming a target in Xcode after the Podfile was written is enough to break the install.

Check
xcodebuild -list -project MyApp.xcodeproj

Fix

Copy the exact name from the did find list into the target block, or rename the Xcode target back. Then install again.

Fix
# Podfile
target 'MyApp-iOS' do
  pod 'Alamofire'
end

Verify

pod install finishes, and a support files folder named after the target appears.

Verify
pod install
ls "Pods/Target Support Files/" | grep MyApp-iOS

Confirmed by raw.githubusercontent.com

Did this fix it?

Cause 2 of 4

A nested test or extension block has no target behind it

You seeThe did find list contains the app target, and the missing name is a test, widget or extension target such as RunnerTests

Check

Nested blocks are checked like top-level ones. Flutter's iOS Podfile template, for one, puts target 'RunnerTests' with inherit! :search_paths inside the Runner block, so a project whose RunnerTests target was deleted, or never existed, fails on that nested block alone.

Check
grep -n -A2 "target 'RunnerTests'" ios/Podfile

Fix

Delete the nested block if the target is gone for good. If you want tests, create the target in Xcode under the same name first, then keep the block.

Fix
# ios/Podfile: remove the block when there is no test target
target 'Runner' do
  use_frameworks!
  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

Verify

The install no longer stops on the test target.

Verify
cd ios && pod install

Confirmed by raw.githubusercontent.com

Did this fix it?

Cause 3 of 4

The block was meant to group pods, not to link a target

You seeThe missing name is a grouping label such as Shared or Common that was never meant to be an app or library target

Check

A plain target block must correspond to an Xcode target. For a set of pods that several targets share, the Podfile reference offers abstract_target, which defines a target that does not link against any Xcode target directly.

Check
grep -n "target 'Shared'" Podfile

Fix

Turn the grouping block into an abstract target and nest the real targets inside it.

Fix
abstract_target 'Shared' do
  pod 'Alamofire'

  target 'MyApp'
  target 'MyAppWidget'
end

Verify

pod install integrates MyApp and MyAppWidget and no longer asks for a target called Shared.

Verify
pod install

Confirmed by guides.cocoapods.org

Did this fix it?

Cause 4 of 4

CocoaPods is reading a different .xcodeproj than the one with the target

You seeThe project named in the error is not the one that holds the target, for example an old copy or a library project

Check

The project in the message comes from the project line of the Podfile; when there is none, CocoaPods uses the single .xcodeproj in the Podfile's folder. A project line left over from an old layout, or a block placed under the wrong project, sends the lookup to a project that lacks the target.

Check
grep -n "^ *project" Podfile

Fix

Point the project line at the .xcodeproj that has the target. CocoaPods resolves the path from the Podfile's folder and adds the .xcodeproj extension when it is missing.

Fix
# Podfile
project 'App/MyApp.xcodeproj'

target 'MyApp' do
  pod 'Alamofire'
end

Verify

The error is gone, or it now names the right project and lists the target you expect.

Verify
pod install

Confirmed by raw.githubusercontent.com

Did this fix it?

How do I stop it coming back?

  • Treat an Xcode target rename and the matching Podfile edit as one change, and let pod install pass locally before you push it.
  • Use abstract_target for shared pod groups, so every plain target block maps to a real target.
  • After deleting a test, widget or extension target, search the Podfile for its name before the next install.

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 on the same stack: TaxiDex, Dispatch Pro, Qist Bazaar.

Next step

Want this handled for good?

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