Program won't start on macOS when using the .app
-
How would I start it from the console?
When I manually start it from application.app/Contents/MacOS/Application it runs fine.and when I double click or open from the filemanager the icon starts bouncing for a few seconds and nothing happens.
The only way I can start from the GUI, is by right-clicking and selecting Show Package Content, and double click the executable in the Contents/MacOS directory.
Could this indicate that macOS for some reason doesn't know what it must execute when I double-click the .app in Finder?
@PatrickKox Additionally, it might be gatekeeper stopping you from running unsigned code (that's the reason I asked do you sign the bundle).
But on dev machine it should work, problem starts when you distribute the bundle. After you run it and it dies check system preferences -> security and privacy -> tab "general". It might be that there is an option where you have to allow this bundle to run (but gatekeeper should also display a warning and notification that you run "potentially dangerous code"). -
@SGaist
No, a blank Widget app works without any problem. -
@PatrickKox No no, I meant the Console, system application showing logs and stuff (cmd+space, "console"). I believe srterr ends up there, when you use system log. But I find it too troublesome to filter through stuff in it, so I just write to text file. It is lame but it works.
@artwaw
Ah, Sorry I thought you were talking about the terminal (since some people also refer to it as the console).Anyway, It seems to give a SegFault when I start it.
Process: HoofdpijnAgenda [5166] Path: /Volumes/*/HoofdpijnAgenda.app/Contents/MacOS/HoofdpijnAgenda Identifier: com.yourcompany.HoofdpijnAgenda Version: 0 Code Type: X86-64 (Native) Parent Process: bash [5160] Responsible: Terminal [3369] User ID: 501 Date/Time: 2021-09-27 20:57:19.111 +0200 OS Version: macOS 11.5.2 (20G95) Report Version: 12 Anonymous UUID: 8E37DB9C-E5D3-B90F-44FA-F8CA1022523D Sleep/Wake UUID: D133E950-78B6-472C-A3AF-10A530D9F01D Time Awake Since Boot: 8100 seconds Time Since Wake: 5200 seconds System Integrity Protection: enabled Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Termination Signal: Segmentation fault: 11 Termination Reason: Namespace SIGNAL, Code 0xb Terminating Process: exc handler [5166]
But why does it work when started from QtCreator or the terminal?
edit:
wait... This is when it actually runs (Terminal and QtCreator), when I start from Finder, there is nothing added to Console (at least not to the crash reports)I do however see this
Sep 28 21:27:47 Patricks-MacBook-Air com.apple.xpc.launchd[1] (application.com.yourcompany.HoofdpijnAgenda.12886989148.12886989233[16445]): Service exited with abnormal code: 1
-
@artwaw
Ah, Sorry I thought you were talking about the terminal (since some people also refer to it as the console).Anyway, It seems to give a SegFault when I start it.
Process: HoofdpijnAgenda [5166] Path: /Volumes/*/HoofdpijnAgenda.app/Contents/MacOS/HoofdpijnAgenda Identifier: com.yourcompany.HoofdpijnAgenda Version: 0 Code Type: X86-64 (Native) Parent Process: bash [5160] Responsible: Terminal [3369] User ID: 501 Date/Time: 2021-09-27 20:57:19.111 +0200 OS Version: macOS 11.5.2 (20G95) Report Version: 12 Anonymous UUID: 8E37DB9C-E5D3-B90F-44FA-F8CA1022523D Sleep/Wake UUID: D133E950-78B6-472C-A3AF-10A530D9F01D Time Awake Since Boot: 8100 seconds Time Since Wake: 5200 seconds System Integrity Protection: enabled Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Termination Signal: Segmentation fault: 11 Termination Reason: Namespace SIGNAL, Code 0xb Terminating Process: exc handler [5166]
But why does it work when started from QtCreator or the terminal?
edit:
wait... This is when it actually runs (Terminal and QtCreator), when I start from Finder, there is nothing added to Console (at least not to the crash reports)I do however see this
Sep 28 21:27:47 Patricks-MacBook-Air com.apple.xpc.launchd[1] (application.com.yourcompany.HoofdpijnAgenda.12886989148.12886989233[16445]): Service exited with abnormal code: 1
@PatrickKox said in Program won't start on macOS when using the .app:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFYTermination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [5166]It does end with segfault.
-
How do you run the program from the terminal? Do run the executable inside Contents/MacOS? Or do you type
open MyApp.app
?If it is about not signing your app like @artwaw suggested, there is a difference to opening the app by just clicking on it (which will then not work) and doing a right click and selecting Open from the context menu.
-
How do you run the program from the terminal? Do run the executable inside Contents/MacOS? Or do you type
open MyApp.app
?If it is about not signing your app like @artwaw suggested, there is a difference to opening the app by just clicking on it (which will then not work) and doing a right click and selecting Open from the context menu.
@SimonSchroeder
I run the executable in Contents/MacOS, when I use open MyApp.app it just ends without any message.I've also tried to sign the app but that doesn't help.
-
Out of curiosity, are you able to create fresh, new, simple program (can be just main window, empty), compile it, macdeployqt-it and run without any issues? Just to check if it is something particular to your main project that fails or the problem is in the environment itself?
-
-
@PatrickKox if a lib or plugin is missing, you may be able to see it. Pipe the output into a file.
and you can do the same thing by running the build with qtcreator which runs well. Then you can compare both output and may be able to find some hints.