Signed and notarized Go app not launching after Gatekeeper dialog

applicationsgatekeeper

I have an app written in Go that is properly code-signed and notarized.

When I download it and launch it for the first time, Gatekeeper will show the usual dialog telling that this application has been downloaded from the web and asking for confirmation to launch it.

I press the Open button, nothing happens.

If I double click on the app a second time, it launches successfully.

The same problem happen when authorizing from the Security & Privacy panel, the app has to be launched a second time in order to show.

I would like to understand what causes this issue and fix it.

My code is there: https://github.com/libretro/ludo

The codesigning and notarization is automated here: https://github.com/libretro/ludo/blob/master/.travis.yml#L76-L88 (and I've double checked that it is working)

The build log is here: https://travis-ci.org/libretro/ludo/jobs/606966338?utm_medium=notification&utm_source=github_status

And the binary is here https://github.com/libretro/ludo/releases/download/v0.9.10/Ludo-OSX-x86_64-0.9.10.dmg

Best Answer

As explained by James Turner, Gatekeeper adds some weird arguments that cause, in my case, the argument parsing lib to exit with error.

Here is a possible fix for your Go programs:

flag.CommandLine = flag.NewFlagSet(os.Args[0], flag.ContinueOnError)