Are LaunchdAgents deleted when the app is deleted

If the user deletes the app, must something be done to ensure that the launchd agent is removed (or is that something that does not need to be worried about in general)? For more context, I am creating a launchd agent using the SMAppService.

I am only an amateur so apologies if this is a bit of a stupid question.

Accepted Reply

Hmmm, that’s a good question, one that I’ve not looked into previously.

I ran a quick test today and, at least on macOS 13, deleting the app does not unregister the agent. I can see why that’s inconvenient, but this sort of behaviour is pretty common on macOS. Apps can be installed anywhere, including removable volumes, and can be installed and removed via a variety of means, and that makes it hard for the system to know when it’s the right time to unregister the agent.

Share and Enjoy

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

  • Thank you for your response! That does make sense for why the launch agent doesn't get un-registered even when I delete my app

Add a Comment

Replies

Hmmm, that’s a good question, one that I’ve not looked into previously.

I ran a quick test today and, at least on macOS 13, deleting the app does not unregister the agent. I can see why that’s inconvenient, but this sort of behaviour is pretty common on macOS. Apps can be installed anywhere, including removable volumes, and can be installed and removed via a variety of means, and that makes it hard for the system to know when it’s the right time to unregister the agent.

Share and Enjoy

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

  • Thank you for your response! That does make sense for why the launch agent doesn't get un-registered even when I delete my app

Add a Comment

Question in a similar vein: if an app has installed and registered a Login Item (via SMAppService), when the application is updated (either manually or via AppStore), do the Login Items registered that are currently running processes get restarted with the newly installed update of the app's relevant executables?

I can find no documentation that describes what happens or is required in the case of an application update.

Add a Comment