Xcode will not open the project: the .xcodeproj has no project.pbxproj
Project MyApp.xcodeproj cannot be opened because it is missing its project.pbxproj fileShort answer
An .xcodeproj is a folder, and Xcode reads the project.pbxproj file inside it to open the project. If that file is not on disk, Xcode refuses to open it. In a Git project the cause is one of three: a commit deleted the file, a .gitignore rule kept it out, or a tool such as XcodeGen is meant to generate it.
Fix it fast
1Find out which cause you have
Look inside the .xcodeproj folder, ask Git whether a rule ignores the file, and see whether the repository has a project.yml. The three answers point to the three causes.
ls -la MyApp.xcodeproj git check-ignore -v MyApp.xcodeproj/project.pbxproj ls project.yml2Match what you see, then jump to its fix
- 1
The folder exists, project.pbxproj is not in it, and no ignore rule matchesA commit, merge or checkout removed the fileFix - 2
git check-ignore -v prints a line naming a pattern, and a fresh clone has an .xcodeproj without the fileA .gitignore rule kept project.pbxproj out of the repositoryFix - 3
The repository has a project.yml and a README or team rule that the .xcodeproj is not committedThe project is generated by XcodeGen and was never generated hereFix
- 1
What does the error look like?
Project MyApp.xcodeproj cannot be opened because it is missing its project.pbxproj filels: MyApp.xcodeproj/project.pbxproj: No such file or directory
Cause 1 of 3
A commit, merge or checkout removed the file
1Check
Search the history for the commit that deleted the file. git log can be limited to one path, and --diff-filter=D keeps only commits that deleted a file.
git log --diff-filter=D --name-status -- MyApp.xcodeproj/project.pbxproj2Fix
Restore the file from the commit just before the deletion. If the file is only missing in your working tree and still exists in the index, git restore without --source brings it back.
git restore --source=<deleting-commit>~1 -- MyApp.xcodeproj/project.pbxproj
# missing only in the working tree:
git restore MyApp.xcodeproj/project.pbxproj3Verify
The file is back on disk and Xcode opens the project.
ls -l MyApp.xcodeproj/project.pbxproj
open MyApp.xcodeprojConfirmed by git-scm.com
Cause 2 of 3
A .gitignore rule kept project.pbxproj out of the repository
1Check
git check-ignore -v prints the source file, line number and pattern that match the path. A pattern that is too wide, such as one that ignores everything inside *.xcodeproj, hides project.pbxproj.
git check-ignore -v MyApp.xcodeproj/project.pbxproj2Fix
Narrow or remove the pattern the command printed. Then take the file from the machine that still has the project, commit it, and clone again to confirm.
# in the .gitignore file named by the output, delete or narrow the matching line
# then copy project.pbxproj into MyApp.xcodeproj/ from the working machine3Verify
The command prints nothing for the path, because the file is no longer ignored.
git check-ignore -v MyApp.xcodeproj/project.pbxproj; echo "exit code: $?"Confirmed by git-scm.com
Cause 3 of 3
The project is generated by XcodeGen and was never generated here
1Check
XcodeGen builds the Xcode project from a spec file called project.yml in the current directory. It lets teams keep the .xcodeproj out of Git, so a fresh clone has nothing to open until you generate it.
ls project.yml2Fix
Install XcodeGen with Homebrew and generate the project in the folder that holds project.yml.
brew install xcodegen
xcodegen generate3Verify
MyApp.xcodeproj now contains project.pbxproj and opens in Xcode.
ls -l MyApp.xcodeproj/project.pbxproj
open MyApp.xcodeprojConfirmed by raw.githubusercontent.com
How do I stop it coming back?
- Keep the ignore rules for Xcode narrow (user data and build folders) and never ignore project.pbxproj in a project that is not generated.
- In a generated project, write down in the README that xcodegen generate is the first step after cloning.
- Review deletions in a merge before you commit it, and look at the file list for the .xcodeproj 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
Xcode cannot find the Info.plist the target points at
The file "Info.plist" couldn't be opened because there is no such file.
Xcode reads the Info.plist path from the target's INFOPLIST_FILE build setting, relative to the project.
3 causes, each with a fixMobile 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 fix