I have been playing with application bundled LaunchAgents:
I downloaded Apple sample code,
Run the sample code as is,
Tweaked the sample code a lot and changed the LaunchAgents IDs and Mach ports IDs,
Created new projects with the learnings, etc.
After deleting all the Xcode projects and related project products and rebooting my machine several times, I noticed the LaunchAgent are still hanging around in launchctl. If I write launchctl print-disabled gui/$UID (or user/$UID) I can see all my testing service-ids:
disabled services = {
"com.xpc.example.agent" => disabled
"io.dehesa.apple.app.agent" => disabled
"io.dehesa.sample.app.agent" => disabled
"io.dehesa.example.agent" => disabled
"io.dehesa.swift.xpc.updater" => disabled
"io.dehesa.swift.agent" => disabled
}
(there are more service-ids in that list, but I removed them for brevity purposes).
I can enable or disable them with launchctl enable/disable service-target, but I cannot really do anything else because their app bundle and therefore PLIST definition are not there anymore. How can I completely remove them from my system?
More worryingly, I noticed that if I try to create new projects with bundled LaunchAgents and try to reuse one of those service-ids, then the LaunchAgent will refuse to run (when it was running ok previously). The calls to SMAppService APIs such .agent(plistName:) and register() would work, though.
Selecting any option will automatically load the page