Search code examples
iphoneiosxcodexcode4xcode4.2

how to locate the built product (app) in Xcode 4x programmatically


I know the location of the DerivedData folder that Xcode creates once I build the project. Is there a way to locate the app present in the below location programmatically? The folder under DerivedData/MyApp-xxxxx is renamed every time I clean the project. Is there a way to record the location in the env of shell just after the app is built.

/Users/macadmin/Library/Developer/Xcode/DerivedData/MyApp-afepqzfgigqcxicavejbdehhtbox/Build/Products/Debug-iphonesimulator/MyApp


Solution

  • The BUILT_PRODUCTS_DIR environment variable should be what you are looking for. If you want to dig into the bundle, you can determine it's name with WRAPPER_NAME. Something like $(BUILT_PRODUCTS_DIR)/$(WRAPPER_NAME) would be the the path to the app bundle.

    /Users/macadmin/Library/Developer/Xcode/DerivedData/MyApp-afepqzfgigqcxicavejbdehhtbox/Build/Products/Debug-iphonesimulator/MyApp.app

    Build and Product Location Build Settings