126

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?

2 Answers 2

184

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

Sign up to request clarification or add additional context in comments.

4 Comments

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?)
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).
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.
From @Ericg the flag is DEPLOYMENT_POSTPROCESSING. In looking at the Xcode 14 flags it confirms that is what is used.
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.

5 Comments

When you need / want to...? I would suggest reading the documentation on DEPLOYMENT_LOCATION, DEPLOYMENT_POSTPROCESSING, & TARGET_BUILD_DIR.
Read it, but what situations do people use them for?
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)
Or when uploading symbol files to firebase or crashlytics. No need to upload that on every single debug build.
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/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.