xcode run-phase pre-action script

I can add a build-phase script to an Xcode C project but not a run-phase pre-action script.

I'd like to reset a test condition each time I run a program I'm debugging. The easiest way to do this is to run a shell script every time I run (debug) the program in Xcode. I can see the place to add this script in Xcode's "edit scheme..."->"Run"->"Pre-actions" setting, but that just displays "No Actions".

I'm probably being stupid but I cannot see any way to add a "script phase" where the scheme currently shows "No Actions" in the scheme's "Run" "Pre-actions" section.

I guess I could try to remember to manually run a shell script from a terminal before chasing down a rabbit hole of debugging, but did I remember to set up that test condition each time I tried to chase the last rabbit?

Do you get a plus button at the bottom right of the action editor? If so, you can choose New Run Script Action and away you go.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"


xcode run-phase pre-action script
 
 
Q