Closed ricoberger closed 4 years ago
Mmm unfortunately, your generated app is incompatible with my OS version (my OS version is 10.14.6 and the minimum required OS version is 10.15) therefore I can't reproduce the problem locally 😞
But what happens if, instead of double clicking the first time, you run open <path to kubenav.app>
? Does it show anything interesting ?
Hi thanks for the fast reply. If I run the app with open kubenav.app
nothing is shown. When I run the command the first time nothing happens, the second time the app is opened.
I tried to build the demo app from https://github.com/asticode/go-astilectron-demo. I replaced all my code with the code from the demo. I only use my bundler.json
file: https://github.com/ricoberger/kubenav/tree/2.5.0/cmd/electron.
When I want to run the builded app, it also starts only when I double click it the second time.
Could you try removing the info_plist
attribute from your bundler.json
? I suspect one its options to cause this... 🤔
I removed the info_plist
attribute from the bundler.json
and also the entitlements.plist
which was used during the singing of the app, but the behavior stays the same for my app and the demo app.
When you test with the demo app, are you signing the app ?
Yes I use the same workflow as for my app. I just replaced my files with the files from the demo app: https://github.com/ricoberger/kubenav/tree/master/cmd/electron to make sure that it isn't related to my code.
OK then I think this is related to the signing of the app. To be sure, could you omit signing the app and see whether you're experiencing the issue ?
Hi, yes the same is happening for unsigned apps (https://github.com/kubenav/kubenav/issues/108#issue-640680353):
First double click results in the following warning:
"kubenav.app" cannot be opened because the developer cannot be verified.
macOS cannot verify that this app is free from malware.
MOVE TO BIN OR CANCEL
Right click and open, prints the next warning:
macOS cannot verify the developer of "kubenav.app". Are you sure you want to open it?
By opening this app, you will be overriding system security which can expose your computer and personal information to malware that may harm your Mac or compromise your privacy.
MOVE TO BIN, OPEN OR CANCEL
Did you enroll in Apple's developer program to get the certificate you use to sign your App ?
Yes, I'm enrolled in the Apple developer program and get the certificate from the Apple developer portal.
OK so this has nothing to do with signing the app. Damn.
Can you try logging something to a file in your app, right at the very top of your main
function ? to see whether the go code is executed or if MacOSX kills it before.
Hi, I think I found the problem with the help of your hint. When I remove the flag.Parse()
command from the main
function the app starts with the first double click.
Currently I only tested it for the demo app. I will try it also with my app tomorrow. Do you already have an idea why this can be a problem?
Thanks again for your support 🙂
Nice catch! The first scenario that comes to mind is that an additional flag is added by MacOSX on the first double click and it makes GO panic. You can easily validate that by adding that code at the top of your main
function :
f, _ := os.Create("/tmp/bundler-issue-75")
defer f.Close()
b, _ := json.Marshal(os.Args)
f.Write(b)
This will log args
provided to the binary in a file located at /tmp/bundler-issue-75
. That way you can see whether there's an additional flag.
If that's the case, there's an easy solution for that.
That's it. For the first start an additional flag -psn_0_6501939
is added.
Ok perfect, take a look at the fix I've just pushed for the demo, it should fix your issue as well. Let me know if you need some explanation.
Works perfect. Thank you 🙂
Hi, first of all thanks for this awesome project. I'm not 100% sure if this is really an issue with astilectron or with my app.
When I want to run an app builded for macOS, it only starts when I double click it the second time. On the first double click nothing happens. I only can find the following errors in the Console.app:
A build where this happens can be found here: https://github.com/kubenav/kubenav/actions/runs/140437555 and the project related issue here: https://github.com/kubenav/kubenav/issues/108
If the app was built locally it works the first time. Also if I run the binary
kubenav.app/Contents/MacOS/kubenav
from the app directly.Any ideas why this happens? Thanks in advance for any help.