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 showFix it fast
Most common cause, 1 of 4The 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.
# Podfile
target 'MyApp-iOS' do
pod 'Alamofire'
endShort 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.
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.
grep -n "target '" Podfile
xcodebuild -list -project MyApp.xcodeprojThen find the line you see in this list and open its fix:
- 1The block name and the Xcode target name differ
The 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 - 2A nested test or extension block has no target behind it
The did find list contains the app target, and the missing name is a test, widget or extension target such as RunnerTests - 3The block was meant to group pods, not to link a target
The missing name is a grouping label such as Shared or Common that was never meant to be an app or library target - 4CocoaPods is reading a different .xcodeproj than the one with the target
The 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.
xcodebuild -list -project MyApp.xcodeprojFix
Copy the exact name from the did find list into the target block, or rename the Xcode target back. Then install again.
# Podfile
target 'MyApp-iOS' do
pod 'Alamofire'
endVerify
pod install finishes, and a support files folder named after the target appears.
pod install
ls "Pods/Target Support Files/" | grep MyApp-iOSConfirmed by raw.githubusercontent.com
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.
grep -n -A2 "target 'RunnerTests'" ios/PodfileFix
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.
# 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__))
endVerify
The install no longer stops on the test target.
cd ios && pod installConfirmed by raw.githubusercontent.com
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.
grep -n "target 'Shared'" PodfileFix
Turn the grouping block into an abstract target and nest the real targets inside it.
abstract_target 'Shared' do
pod 'Alamofire'
target 'MyApp'
target 'MyAppWidget'
endVerify
pod install integrates MyApp and MyAppWidget and no longer asks for a target called Shared.
pod installConfirmed by guides.cocoapods.org
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.
grep -n "^ *project" PodfileFix
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.
# Podfile
project 'App/MyApp.xcodeproj'
target 'MyApp' do
pod 'Alamofire'
endVerify
The error is gone, or it now names the right project and lists the target you expect.
pod installConfirmed by raw.githubusercontent.com
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.