Reputation:
I am using xcodebuild from command line in a script, but I realized that I cannot specify the path of the project that i wanna build;I am forced to cd in the folder where the project is.
Is there a way to accomplish the build process without having to cd in the directory, or this is how it must be?
Is not a big deal to cd into the directory and execute xcodebuild, but I wonder what if someday you need to build a project and you cannot cd into the directory....It doesn't really make sense to me to not being able to specify the path.
Upvotes: 13
Views: 5882
Reputation: 4677
You can use xcodebuild -project pathtoprojectfile
eg
xcodebuild -project /IOSprojects/YourProject/YourProject.xcodeproj
Upvotes: 27
Reputation:
You must be in the directory containing the project(s) when you run xcodebuild
. If you don’t want to mess with your current directory, there a couple of options:
/bin/sh -c "cd $PRJDIR; xcodebuild"
or
(cd $PRJDIR; xcodebuild)
Upvotes: 6