How to display compiler output or custom build steps output when building with xcode?
Solution 1
Pre-action output at least appears in system.log and is visible in Console.app.
Solution 2
You'll find (and you can watch during the build) the complete build output in the Log Navigator. That's the right most icon of the small icons just below the Run and Build buttons.
Solution 3
EDIT: as pointed out in the comment below this answer only works for Build phase scripts, not pre action and post action scripts.
In Xcode 8 you need need to select your latest build in "Navigator -> Report Navigator". In the main area you will be able to see the complete build log including your output.
Here is a simple "Hello world" echo
Solution 4
Per my answer here ( Is it normal for Xcode not to detect if a pre-action failed? ) this is an issue that's been discussed in the dev forums. Pre-/post-action script non-zero status doesn't seem to have an affect, nor does the output seem to make it into any logs.
Solution 5
In my case, I have to show the user the error from pre-action
scripts in a friendly way. Inspired by this custom archive script, I figured out that I can show dialog or script in Xcode.
show_dialog() {
/usr/bin/osascript -e 'set titleText to "pre actions script error"
set dialogText to "Please install xxx to fix it"
display dialog dialogText with icon stop with title titleText'
}
show_dialog
I use stop
icon here, You can also use other icons, like note
, and caution
- If showing dialog or alter is too harsh, you might consider
notification
as well.
show_notification() {
/usr/bin/osascript -e 'display notification "Please install xxx to fix it" with title "A error happens" subtitle "Prebuild" sound name "Frog"'
}
show_notification
For me, I usually use Script Editor
to edit the AppleScript functions, then copy them to the Shell script
Apple Ref
sorin
Another geek still trying to decipher the meaning of “42”. It seems that amount his main interest are: online communities of practice and the way they evolve in time product design, simplicity in design and accessibility productivity and the way the IT solutions are impacting it
Updated on July 22, 2022Comments
-
sorin almost 2 years
How can I see the output from the compiler of from the custom build steps (pre-action or post-action)?
-
sorin over 13 yearsThanks for giving me this hint, the only problem is that I do not see anything reffering to the pre-action or post-action for build. I included and
echo
on the shell script and I do not see it. -
sorin about 13 yearsI was not able to find any discussion about this on the devforum, but I added a new tread devforums.apple.com/message/427106#427106
-
TahoeWolverine about 13 yearsThanks for posting this. I was trying to find the item by item build results ala xcode 3 and this is about as close as you get.
-
Takagi almost 13 years+1. I have been looking at the Log Navigator, but was unable to see my echo's being outputted. Then I checked Console.app and I now see them listed there. So Console.app works.
-
daver almost 12 yearsLog Navigator output doesn't include output from Scheme "Run Script" pre-actions. As Jonah notes it can be seen in Console.app
-
Dan Nissenbaum over 10 yearsFor anyone who can't find the raw compiler output simply by "showing" the Log Navigator: With the Log Navigator showing, there should be a list of overall steps, in XCode format, with check marks next to them, in the main pane. Find the step of interest (in mine, it says "compile main.cpp"). Click on it. To the very right, will appear a tiny little icon that looks like a text file. Click on this, to finally reveal the %&^%* compile output.
-
OrangeDog about 10 yearsxcode 5.1 - I don't see my echoes in there. Did it change or is my pre-action script not actually being run?
-
hunteros over 9 yearswhat does "checked Console.app" mean? I can't seem to find my scheme pre-action script output
-
david van brink over 9 yearsstackoverflow.com/questions/19014359/… discusses for Xcode 5, thanks! Whew.
-
AnneTheAgile almost 9 yearsthe forums have moved, and I didn't see any discussion of this topic in the new forum. forums.developer.apple.com/search.jspa?q=xcode+log
-
Pranshu over 7 yearsThis only applies for scripts added to Build phases, the question specifically asks for pre action and post action scripts where it doesn't work.
-
Luc about 2 yearsOut of all the answers here, this is the only one that worked for me. Just had to replace
${PROJECT_DIR}
with the manual path to my directory. I also wrote a command thattail
s theprebuild.log
file so I can see the log as it runs.