AndreG
AndreG

Reputation: 1948

xcodebuild: error: 'project.pbxproj' is not a project file

I am new to Xcode so I am probably doing something wrong (or missing something in this case). I would appreciate any help.

I've just created a new project on Xcode. New Project -> macOS -> Command Prompt. I've saved it somewhere and as soon as Xcode returns with its main screen on my project's properties, I've closed it. Then cd'd to the folder where my .xcodeproject was (on terminal) and ran xcodebuild install and it returns me that message. Additionally, I tried editing my project Schema from debug to release and closed Xcode again (to make sure everything was saved), same error.

If I build the project from Xcode's UI it works, obviously, it will print Hello World, but I can't run the builder from command line. Does anyone have any tips? Thank you!

This is on Xcode 8.3.3.

Upvotes: 2

Views: 2974

Answers (2)

PhillipJacobs
PhillipJacobs

Reputation: 2490

I ran into this issue and my error was due to an overlooked flag in my .gitlab-ci.yml file.

Pretty easy fix :)

So the error says:

xcodebuild: error: '<some file>' is not a project file.

The reason for that was because in my .gitlab-ci.yml file it said -project instead of -workspace

Super easy to overlook. So if you have the: is not a project file error, make sure your flag says -workspace and not -project.

Alternatively if you have the opposite error xcodebuild: error: '<some file>' is not a workspace file then you'll want to change your -workspace flag to -project


Upvotes: 7

AndreG
AndreG

Reputation: 1948

My bad... the xcodebuild install command works from one directory up, outside the .xcodeproj folder.

Upvotes: 2

Related Questions