Important: Please read the Qt Code of Conduct -

Codesigned app gets "developer not confirmed" on macOS Sierra

  • I build and codesign my Qt 5.6.1 app on Yosemite 10.10.3 using a bash script. I upload the dmg to my OneDrive, then download it on OS X or MacOS. On a clean Yosemite (10.10.3), it works great, as expected: when I try to run it the first time, I get the message that the app is downloaded from the internet, and gives me the option to open it.

    However, on El Capitan 10.11.1 and Sierra 10.12.3, when I try to run it the first time it gives me the dreaded, "[My app] can't be opened because the identity of the developer cannot be confirmed." I know I can give users instructions on how they can open it anyway, but that's not a great solution. I am codesigning the app, so I'd like Gatekeeper to be happy with it.

    The basic checks I found make it seem that my app is fine (running on Sierra, pointing to my binary inside the [my app].app/Contents/MacOS folder):
    codesign --verify --deep --strict --verbose=2 <code-path>

    <code-path>: valid on disk
    <code-path>: satisfies its Designated Requirement

    spctl -a -t exec -vv <code-path>

    <code-path>: accepted
    source=Developer ID

    In the "Checking Gatekeeper Conformance" section here, I found a few new requirements since OS X 10.10.3. Using otool -L I discovered I do indeed have 8 @rpath's in my app, all for Qt items in the Frameworks folder in my bundle. From a command line on my build machine (10.10.3), I can use install_name_tool -change to change the @rpath's to @executable_path/../ and verify the change with otool -L, but when I put the exact same command to change one of the @rpaths in a one-line script, it does nothing: otool -L still shows @rpath for the item that should have been changed.

    For example: the command:

    install_name_tool -change @rpath/QtCore.framework/Versions/5/QtCore  @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore  /Users/david/dev/git/map-creator-qt/build/mac/pkg-root/Applications/

    successfully changes the output of otool -L, but this script does not:

    install_name_tool -change @rpath/QtCore.framework/Versions/5/QtCore  @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore  /Users/david/dev/git/map-creator-qt/build/mac/pkg-root/Applications/

    The script fails with "No such file or directory".

    My questions:

    1. Am I even on the right track? I think I need to replace all my @rpaths with @executable_path/../. Is that correct?
    2. If I am on the right track, what should I do next, since the exact same command works from a command prompt, but not when run from a script?


  • Lifetime Qt Champion


    1. Seems like you are yes.
    2. You should rather pass the path to your application executable to your script, that will avoid having to change it when you change your build folder.

    1. Thanks - that is helpful.
    2. Actually, for my real script I do pass in the path. Since it didn't work I was eliminating all variables. Even with the full path hardcoded, it works fine from the command line but not in the 1-line script. Any idea why that would be?

  • Lifetime Qt Champion

    Can you show your orignal script content ?

  • I'm now past the first hurdle: apparently I had some weird line-ending issue that caused the script to fail. Once I basically retyped the new commands, the script to worked as expected. In both a small test and my real script, I can now remove the rpath from the executable using install_name_tool -delete_rpath, and replace all @rpath's with @executable_path/../'s using install_name_tool -change. Sorry for the (very lengthy for me) rabbit trail!

    Unfortunately, though, that does not solve my real problem. When I download from OneDrive, on first run on Sierra still gives the same "developer not confirmed" message. On closer reading here and here, it seems to me that the Qt rpath's shouldn't be a problem anyway, since they point to the Framework folder inside my app bundle. Also, I'm unable to find "Fails dylib check" in the system log after attempting to open the application.

    I do find this error in the system log (in Diagnostic and Usage Data in Console):

    11:06:46.309195 -0400	CoreServicesUIAgent LSRiskCategoryUnsafeExecutable

    followed immediately by:

    11:06:48.372426 -0400	syspolicyd	assessment granted for .app by Developer ID bundle:com.fmosoft.mapcreator .app UNKNOWN 1 granted:Developer ID

    I haven't found anything helpful on what signature5 is. But another possibility: I had checked on my build machine in KeyChain Access that my Developer ID Application and Installation certificates are valid. They expire Dec. 12, 2017. However, it appears that our Developer Program Membership has expired, when I try to log in at

    I'm unclear: should a certificate that is not expired be sufficient for signing my app, or do I have to also have a currently active membership in Apple's Developer Program when I sign my app?

  • We renewed our Apple Developer Program membership this afternoon. After that was complete and I verified I could log in to the Apple Developer web site again, I tried building my app again, this time on Sierra instead of on Yosemite.

    The build completed successfully. I uploaded the dmg to OneDrive, then downloaded it to the same Sierra build machine. I got the same "developer not confirmed" result on first run, same system log messages as above. So building on Sierra made no difference as far as I can tell, nor did paying Apple their money.

    spctl -a -t exec -vv <my>, codesign --verify --deep --strict --verbose=2 <my>, and check-signature (from Apple here) all indicate that everything is fine.

    I'm stumped. I've been Googling the LSRiskCategoryUnsafeExecutable error and haven't turned up anything.

    Here's the part of my build script that does the code signing. We sign the main app and the help file app in our script but I'm focusing at this point on just the part for the main app, I'm including the comments in the script in case they are helpful to someone.

    # Sign the bundles
    # Currently due to concurrency bug (20497047 and 20249918) in Apple's code somewhere, we can't simply codesign and be done.
    # A workaround is to use the flag --timestamp=none but apparently that will cause the app's signature to break as soon as our certificate expires.
    # The current workaround is to loop until codesign succeeds.  But apparently codesign can do something and fail, then all attempts to codesign that folder will fail.
    # So, we have to copy the .app's and start with a fresh copy for each codesign attempt.
    # See
    # and
    # Create a clean backup of both .app's
    cp -R "$BUILDDIR/pkg-root/Applications/" "$BUILDDIR/pkg-root/Applications/"
    cp -R "$BUILDDIR/pkg-root/Applications/" "$BUILDDIR/pkg-root/Applications/"
    # repeat signing Map Creator until the exit value is true (i.e. no crash)
    until codesign --deep --force --verify --verbose --sign "[our ID]" "$BUILDDIR/pkg-root/Applications/"; do
      echo Failure. Trying again...
      rm -rf "$BUILDDIR/pkg-root/Applications/"
      cp -R "$BUILDDIR/pkg-root/Applications/" "$BUILDDIR/pkg-root/Applications/"

    Any ideas what the problem could be, or how to try to track it down?

  • Lifetime Qt Champion

    Did you also sign all the frameworks and plugins ?

  • I think --deep takes care of signing the frameworks and plugins (and everything else). When I look in the bundle, there's "_CodeSignature" folders in the Frameworks, and at the top level (under Contents).

    There isn't any "_CodeSignature" folder in the PlugIns, SharedLibraries, or Resources folders. However, they appear to all be represented in the top-level _CodeSignature/CodeResources file.

    However, I notice there is no _CodeSignature folder in MacOS, where my executable resides. Could that be the problem?

  • Except, I remember reading that the code signature actually gets embedded in the executable, rather than being a separate folder.

  • In an effort to satisfy Sierra's Gatekeeper, I have switched to building and codesigning on macOS 10.12.3. I still have the same problem, but since I'm not building on Yosemite anymore, I have opened a new question here, with a minimal sample app and build script.

  • The solution that worked for me turned out to be using otool -l to find which frameworks had LC_RPATH outside the bundle, and removing them. I'm now building on Sierra, but I tested and the same solution I noted here works on Yosemite.

  • Lifetime Qt Champion

    Thanks !

Log in to reply