jhabbott
jhabbott

Reputation: 19311

How to find xcode build directory from the command line?

There are lots of questions/answers about controlling where to put the 'build' directory when building Xcode projects from the command line, but rather than trying to fight this is there a way to get the path that Xcode is using?

I know it puts the files in ~/Library/Developer/Xcode/DerivedData/APPNAME-xxx/Build/ where xxx is some random-looking string. I want to be able to get this directory from the command line so that I can archive my .app and .dSYM files, and also re-sign and package my .app using xcrun PackageApplication, which I currently use to create an over-the-air installable version directly form the build-server (hudson).

Upvotes: 5

Views: 5256

Answers (2)

Tejasvi Manmatha
Tejasvi Manmatha

Reputation: 654

For workspace

xcodebuild -scheme scheme-name -workspace proj.xcworkspace ONLY_ACTIVE_ARCH=NO -sdk iphonesimulator -configuration Debug -showBuildSettings | grep -m 1 "BUILT_PRODUCTS_DIR" | grep -oEi "\/.*" 

For Proj files

xcodebuild -project yourproj.xcodeproj ONLY_ACTIVE_ARCH=NO -sdk iphonesimulator -configuration Debug -showBuildSettings | grep -m 1 "BUILT_PRODUCTS_DIR" | grep -oEi "\/.*" 

Upvotes: 13

Slav
Slav

Reputation: 27505

From command line

xcodebuild -project yourproj.xcodeproj -showBuildSettings | grep TARGET_BUILD_DIR

Remove the grep pipe, to see a list of all build settings, and choose one that is most appropriate for what you are looking for

Upvotes: 13

Related Questions