Xcode scheme pre-action script not running

Pre-action takes place before the build, so output doesn’t go to the build log, it goes to stdErr. You can copy the output to a file:

exec > ${PROJECT_DIR}/prebuild.log 2>&1
echo "hello world"

To get the environment variables to work, you also need to set “Provide build settings from” to the appropriate target.

enter image description here

That should write hello world to a file named “prebuild.log” in your project folder.

for XCode versions < 13.2
If you want these activities to end up in the build log, consider adding a run script to your target’s build phase instead.

for XCode versions >= 13.2
The XCode build log now includes a Run pre-actions section. If you don’t redirect to a file, those messages will end up as the last item in a ‘Run custom shell script’ in this section – access via the XCode Report Navigator.

enter image description here

enter image description here

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)