Xcode Run script Build Phase "run script only when installing" option
Asked Answered
S

2

120

There is a "run script only when installing" option in Xcode Run script Build Phase, I am not able to find documentation on this. What does it do?

Schizogenesis answered 6/5, 2011 at 14:57 Comment(0)
M
181

With Run script only when installing checked, the script only runs when do Product Archive.

Macaque answered 20/2, 2014 at 19:22 Comment(4)
Not when building/installing on a device? (That is: CMD-B build & run to a physical device (not sim) with the device plugged in. Does that not count as "when installing" for this switch?)Mecklenburg
Debug-installing on a real device (build & run from Xcode) does not count as "installing". The run script only runs when archiving (tested with Xcode 9).Whaleboat
Actually this is only partially correct. It depends on the DEPLOYMENT_PROCESSING setting. I'm basing this from running this on Xcode 10. It appears that when you archive, DEPLOYMENT_PROCESSING is set to YES and overrides the setting for the configuration. I've confirmed this through building and seeing the settings in the output since I have "Show environment variables in build log" set to on.Skerrick
From @Ericg the flag is DEPLOYMENT_POSTPROCESSING. In looking at the Xcode 14 flags it confirms that is what is used.Feck
S
21

In the Xcode Build System Guide (Xcode 3.2.x), it says:

Run script only when installing. Runs the script only during install builds, that is, when using the install option of xcodebuild or when the build settings Deployment Location (DEPLOYMENT_LOCATION) and Deployment Postprocessing (DEPLOYMENT_POSTPROCESSING) are on.

Seneschal answered 6/5, 2011 at 16:2 Comment(5)
When you need / want to...? I would suggest reading the documentation on DEPLOYMENT_LOCATION, DEPLOYMENT_POSTPROCESSING, & TARGET_BUILD_DIR.Seneschal
Read it, but what situations do people use them for?Schizogenesis
Re: when would you want to use this: I use this flag on scripts that increment the build number, so that it only happens on builds I archive to send out to beta testers (and not every single time I run the app)Nerin
Or when uploading symbol files to firebase or crashlytics. No need to upload that on every single debug build.Whaleboat
Actually Fabric tells that symbol files should be uploaded every build. There are better way to configurate the uploading of dSYM. support.crashlytics.com/knowledgebase/articles/…Underclassman

© 2022 - 2024 — McMap. All rights reserved.