I was trying out SMAppService on macOS Ventura to register LaunchDaemons and LaunchAgents.
Apparently I didn't get it quite right 🙈 So now I am in a situation where I registered a LaunchDaemons (it showed up in System Settings > General > Login Items) and did not throw an error on registering, but it doesn't really work and I am not able to unregister it.
SMAppService.unregister()
returns SMAppServiceErrorDomain Code 113 "Could not find the specified service". The SMAppService
instance I am trying to use for unregistering was created the same way that I registered, using SMAppService.daemon(plistName: "some.plist")
.
Is there any way to reset the state or remove the broken daemon config manually? I tried removing all copies of my app from the system and rebooting, but that didn't clean it out.
Is there any way to reset the state or remove the broken daemon config manually? I tried removing all copies of my app from the system and rebooting, but that didn't clean it out.
In Terminal, run sftool resetbtm
, authenticate if needed, and reboot.
However, the entry in System Settings > General > Login Items is not gone. It's still there and enabled. It also persists across reboots & after removing all copies of my app.
That is the current behavior. The state is persisted to preserve user intent.