Running xcodebuild
from the console will bring you very verbose output and I wasn't able to locate any options for limit its output in order to display only warnings and errors.
I'm looking for a way to capture the xcodebuild
output and filter it. It would prefer a Python solution that will work with pipes but I'm open to other approaches as long they are command line based solutions.
Are any tools that are already able to do this?
This isn't sufficient for me. Piping to /dev/null will just show you that a build failed, but you don't see the reason(s) why. Ideally we could see just the errors and/or warnings without all of the successful compiler commands.
This basically does the job:
-quiet
is the best way to do it at now.There’s a Ruby gem called
xcpretty
.It filters the output of
xcodebuild
and also provides different formatters and coloring.Use
xcodebuild -quiet
.According to the xcodebuild man page:
Bonus: No other tools necessary! (Although I also like
xcodebuild | xcpretty
)I build with Travis CI, which complains after 4 MB of logs. This argument solved the problem.
To only see the error output messages, redirect the standard output to /dev/null (a special file that works as a black hole) like this:
If you want to capture the error output into a file, you can do:
I love
xcpretty
for looking at as a human, but I had a need to find build errors in an automated setting for propagation elsewhere, and I wanted to be sure I captured just the relevant information. The following sed command serves that purpose:Output: