xcodebuild cannot find the scheme you asked it to build
does not contain a scheme namedShort answer
xcodebuild only sees schemes that exist in the project or workspace you name on the command line. Run xcodebuild -list on that same container and read the Schemes section. The error means the name is wrong, the scheme lives in the other container, or it was never shared with the build machine.
Fix it fast
1Find out which cause you have
Ask xcodebuild itself which schemes it can see, using the same container you pass to the failing build. Compare the printed names with your -scheme value.
xcodebuild -list -workspace MyApp.xcworkspace # or, for a project without a workspace xcodebuild -list -project MyApp.xcodeproj2Match what you see, then jump to its fix
- 1
The Schemes section is printed, but your name is not in it, or differs in spelling or caseThe scheme name does not match what the list showsFix - 2
The scheme shows in xcodebuild -list -workspace but not in xcodebuild -list -projectThe scheme belongs to the workspace, but you passed the project (or the reverse)Fix - 3
Xcode builds fine locally, but a CI machine or another account does not list the schemeThe scheme exists only on your Mac because it is not sharedFix
- 1
What does the error look like?
does not contain a scheme namedxcodebuild: error: ... does not contain scheme
Cause 1 of 3
The scheme name does not match what the list shows
1Check
Schemes are named by you, and a rename in Xcode does not change a script that still holds the old name.
xcodebuild -list -project MyApp.xcodeproj2Fix
Copy the name from the Schemes section into the -scheme argument. Quote it when it contains a space.
xcodebuild -scheme "My App" -project MyApp.xcodeproj build3Verify
The build starts instead of printing the error.
xcodebuild -scheme "My App" -project MyApp.xcodeproj buildConfirmed by developer.apple.com
Cause 2 of 3
The scheme belongs to the workspace, but you passed the project (or the reverse)
1Check
Apple documents -workspace for a scheme contained in a workspace and -project for a scheme contained in a project. A CocoaPods or multi-project setup keeps the app scheme in the workspace.
xcodebuild -list -workspace MyApp.xcworkspace
xcodebuild -list -project MyApp.xcodeproj2Fix
Pass the container that actually lists the scheme.
xcodebuild -workspace MyApp.xcworkspace -scheme MyApp build3Verify
Rerun the build with the workspace on the command line.
xcodebuild -workspace MyApp.xcworkspace -scheme MyApp buildConfirmed by developer.apple.com
Cause 3 of 3
The scheme exists only on your Mac because it is not shared
1Check
Fastlane's build_app documentation asks that the scheme be marked Shared. Check that the project holds a shared scheme file, not only your user data.
find . -path "*xcshareddata/xcschemes/*.xcscheme" -not -path "./Pods/*"2Fix
In Xcode click the scheme name in the toolbar, choose Manage Schemes, tick Shared for the scheme, then commit the new xcscheme file to source control.
git add MyApp.xcodeproj/xcshareddata/xcschemes/MyApp.xcscheme
git commit -m "Share the MyApp scheme"3Verify
On the CI machine, after pulling, list the schemes again.
xcodebuild -list -project MyApp.xcodeprojConfirmed by docs.fastlane.tools
How do I stop it coming back?
- Keep the scheme shared and committed, so every build machine sees it.
- Run xcodebuild -list once in the build script's first step, and fail early with the output.
- Pass both the container and the scheme explicitly rather than relying on the current folder.
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?
Related fixes
Mobile apps
Cannot change the App Privacy answers in App Store Connect
Publish Your App Privacy Responses?
Only the Account Holder, Admin and App Manager roles can answer the App Privacy questions.
2 causes, each with a fixMobile apps
App record creation fails because you lack permission
You cannot add a new app in App Store Connect as a Developer or limited user
Only the Account Holder, an Admin or an App Manager can create an app record, and Apple blocks it until the Account Holder has signed the latest agreement.
3 causes, each with a fixMobile apps
You cannot find the button to pull your app back from review
No 'remove this version from review' message appears on the version page
There is no button called Reject Binary.
3 causes, each with a fixMobile apps
Your Apple Account cannot sign in to App Store Connect
Sign-in to App Store Connect is refused for an account that should have access
App Store Connect does not open to every Apple Account.
3 causes, each with a fixMobile apps
Apple rejected the app under Guideline 4.3, Design: Spam
Guideline 4.3(b) - Design - Spam
Guideline 4.3 is Apple's duplicate rule.
5 causes, each with a fixMobile apps
App Store Connect rejects a screenshot because it has transparency
Images can't include alpha channels or transparencies.
App Store Connect does not accept screenshots that carry an alpha channel or transparent pixels.
2 causes, each with a fix