Add Run Script Phase only for Debug Configuration XCode 3.2 - xcode

I want a run a script post-build for an XCode 3.2 project, so I added a "Run Script" phase to my target. It works great, but I only want to run this script in the Debug configuration, does anyone know how to do this?
thx,
A

Take a look at this answer, it looks to do what you are looking for. Running script only for an 'Archive' build in Xcode 4

Related

How to get a Run Script phase to run first during compile in xcode?

In xcode 10.2, there is a run-script build phase. I have a script to copy a framework to a specific pod in DerivedData/somename-someguid/products/etc...
However, it seems that the script is not running first based on the print statements and it fails to find the file. If I manually copy the file there first, I can see the output of my script in the build log and it succeeds.
I tried dragging it up in the build-phase panel. I also tried adding it to the copy-file section, but copy does not understand how to embed with the correct pod.
Is there a way to specify the order of running these scripts? Is there a pre-everything section I don't know about?
Of course, it turns out I had the run script phase on the main app project instead of the pod project targets not realizing it built the pods first. So adding it there fixes it. Saving other noobs from this mistake by leaving the question up....

XCode performs custom behavior .sh script failed with The operation couldn’t be completed,Exec format error

As you can see near the screenshot Logs infos pic, the .sh Script can run normal inside terminal, but failed to run via Xcode custom behavior, Is there missing some configuration? I've Googled a lot of infos. still can't solve it. I really need someone's help. Thanks
XCode version: Version 8.3.2 (8E2002)
Add a New Run Script Phase in your projects Build Phases to run a Shell script. You do not need to open -a Terminal:
Update:
How I understand your comment, your actual question is how to get the Xcode project directory. Xcode provides a enviromental variable for this, ${PROJECT_DIR}:
prints:
You can find a list of Xcodes enviromental variables in this repo and helpful information in Apples documentation.

In Xcode 6.2 how do you add a Run Script build phase that runs a Swift script?

I want to run a Swift script as part of my Xcode project build but I'm getting many errors when I add it. (Screenshot showing some of the errors is attached.) Am I missing something?
My run script build phase looks like this:
(Shell: /bin/sh)
swift path/to/my/script
You have to include full path to swift which would be for current release
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift path/to/your/script
Or for any beta version of Xcode it would be
${PATH_TO_XCODE_BETA_DOT_APP}/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift path/to/your/script
Or you my just write you script directly in run script build phase like so :

How do I make Xcode 4 run my Pre-Actions?

I can't seem to get Xcode 4 to reliably execute my pre-actions. I've tried cleaning and rebuilding. It doesn't seem to do it consistently. Is it even trying? I can't tell. I've put some echos in it (it's a bash script) and nothing is happening. This all worked in Xcode 3.
Note that your pre-build actions are not executed in your project's source directory. They are executed somewhere in Library/Developer/XCode/DerivedData/.
If you want to play with files in your project's source directory before compilation, you need to prepend it with ${PROJECT_DIR}/.
You need to add a "Run Script" to your build phases, and then drag it's position above the compile sources build phase.
I don't understand the purpose of a "pre-action" yet, doesn't seem to even get executed. However in my case I just needed a script to execute before my sources were compiled.
Remember that pre-actions do not pick up env variables. They are primarily meant to load or notify that the build is starting. If it worked in Xcode 3, you may want to use it more as a build script than a pre-action.

Xcode Run script Build Phase "run script only when installing" option

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?
With Run script only when installing checked, the script only runs when do Product Archive.
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.

Resources