Command [something] failed with a nonzero exit code

This thread has been locked by a moderator; it no longer accepts new replies.

In most cases Xcode does a good job of surfacing build problems. If, for example, your Swift code has an error, Xcode’s Issues navigator shows you exactly what went wrong.

However, that’s not universally true. In some cases the Issues navigator will show you a message like Command [something] failed with a nonzero exit code, where [something] is a build step like CodeSign or CompileC. To investigate these problems, look at the build report.

The easiest option is to click on the issue in the Issues navigator. In most cases that will:

  1. Switch to the Reports navigator (View > Navigators > Reports).

  2. Select the correct build report on the left.

  3. Select the correct build step in the report editor.

  4. Expand its transcript (Editor > Expand Selected Transcripts).

Note If that doesn’t work automatically, perform each of these steps by hand.

That transcript includes both the details of the build step and all the information about the failure. For example, when I set my Other Code Signing Flags build setting to --varnish-waffles, I got the transcript included at the end of this post. As you can see, the codesign command really isn’t up for the task of varnishing waffles (-:

Additionally, at the top of the report editor there’s an Export button. Click this to save a text file with the transcript of every build step. In DTS we call that the full build log.

The full build log has a couple of nice properties:

  • When investigating a complex build problem, use the full build log to trace build activity across multiple build steps.

  • If you’re asking for help with a build problem, give your audience all the details by attaching the full build log.

Share and Enjoy

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

…/IssueNavigatorTest (in target 'IssueNavigatorTest' from project 'IssueNavigatorTest')
    cd /Users/quinn/Desktop/IssueNavigatorTest
    
    Signing Identity:     "Apple Development: Quinn Quinn (7XFU7D52S4)"
    
    /usr/bin/codesign 
        --force 
        --sign 8CEF1273B13E1C6E7F6E73EBBEF42278F0D88C97 
        --varnish-waffles 
        -o runtime 
        --entitlements …/IssueNavigatorTest.xcent 
        --timestamp\=none 
        --generate-entitlement-der 
        …/IssueNavigatorTest

codesign: unrecognized option `--varnish-waffles'
Usage: codesign -s identity [-fv*] [-o flags] [-r reqs] [-i ident] path ... # sign
       codesign -v [-v*] [-R=<req string>|-R <req file path>] path|[+]pid ... # verify
       codesign -d [options] path ... # display contents
       codesign -h pid ... # display hosting paths
       codesign --validate-constraint path ... # check the supplied constraint plist
Command CodeSign failed with a nonzero exit code
Boost
Command [something] failed with a nonzero exit code
 
 
Q