After app crashes launchctl is no longer able to start app

We are noticing a strange behavior with our app and launchctl, not sure yet if it is only in M1 Monterey Macos. We have a launchctl plist that has not changed for a while that allows the app to restart after a crash via the Keepalive key

	<key>KeepAlive</key>
	<dict>
		<key>SuccessfulExit</key>
		<false/>

What we are noticing is that the app crashes and instead of the app reopening via launchctl , an Apple crash report window opens. The app is used in several headless environments and we are trying to understand asap how to deal with this change of behavior. Any input will be helpful. Is there an option in xcode to modify this kind of behavior ? For example set the app to show a crash report instead of launchctl executing. Is there a way to trace why launchctl did not reopen the app ? Does it make a difference if the app is a debug version ? We have noticed no difference between Release and Debug versions, same behavior.

  • to add to the weirdness launchctl bootout gui/501/com.cirrusthinking.dollyappd Boot-out failed: 125: Unknown error: 125 no matter what I try I get failed errors on non legacy commands

Add a Comment

Replies

I’d like to clarify what you mean by “app” in this context. Is this a program that displays a GUI, shows up in the Dock, and could reasonably be launched by the user by double clicking its icon in the Finder? Or something else?

Share and Enjoy

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

The "app" is displayed in the Dock, its a GUI and a Status Bar item. We where able to resolve the issue by adding an extra key in the plist

<key>MachServices</key>
and
<key>Crashed</key>
<false/>

Still, the man pages are not enough to decipher all different options available and there is not enough documentation on the Apple developers site to well define the xml logic according to various MacOS version need. ....

The "app" is displayed in the Dock, its a GUI and a Status Bar item.

OK. In that case it’s pretty normal for a crash to trigger the crash report UI. That’s what GUI apps do by default. AFAIK that’s a property of the app, not the way that the app was launched. You see the same thing if you run a GUI app from Terminal.

The standard solution is to mark the app as a UI element (via the [LSUIElement property][refLSUIElement]) but that prevents it from showing up in the Dock or having its own menu bar. I can still display a status bar item just fine.

We where able to resolve the issue by adding an extra key in the plist

I’m not sure what you mean by that. Please post the final launchd property list that you settled on.

Share and Enjoy

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

The standard solution is to mark the app as a UI element (via the [LSUIElementproperty][refLSUIElement]) but that prevents it from showing up in the Dock or having its own menu bar. I can still display a status bar item just fine.

Any alt option in xcode so that we can still have the app icon appear in Dock , even if it is a status bar item, but prevent the Crash Report UI ?

Please post the final launchd property list that you settled on.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>KeepAlive</key>
	<dict>
		<key>Crashed</key>
		<false/>
		<key>SuccessfulExit</key>
		<false/>
	</dict>
	<key>Label</key>
	<string>com.cirrusthinking.dollyappd</string>
	<key>LimitLoadToSessionType</key>
	<string>Aqua</string>
	<key>MachServices</key>
	<dict>
		<key>com.cirrusthinking.dollyappd</key>
		<true/>
	</dict>
	<key>ProgramArguments</key>
	<array>
		<string>open</string>
		<string>-W</string>
		<string>/Applications/DollyDrive.app</string>
	</array>
</dict>
</plist>

Any alt option in xcode so that we can still have the app icon appear in Dock, even if it is a status bar item, but prevent the Crash Report UI?

Not anything that springs to mind [1]. If an app appears in the Dock it’s a user-visible thing. If a user-visible thing goes away, you get a crash report. That makes sense to me.

With regards your launchd property list, why are you bouncing through open?

Share and Enjoy

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

[1] You can play code-level games to suppress the crash reporter but that’s not something I’m comfortable recommending.