Application running a daemon, what about uninstalling?

I have a application that is only the UI for a daemon service. The daemon itself is runnning ok, so far.

Now when the user moves the App to trash bin, will the daemon also be uninstalled? How does most MacOS software does that behind the scenes? Like, MS Teams, it runs a daeamon but when the user removes the app the daeamon should be also removed.

I am using Packages for installing, so I can for example update, but differently from Windows we normally don`t have an uninstall program.

I would appreciate any explanation on that, as for my research I was able to find only how to create daemons.

Please define what you mean by “daemon”. Strictly speaking, a launchd daemon runs in the global execution context, which means it’s available to all users on the system. Many folks use the term daemon to refer to any program that’s executing in the background.

How is your daemon being installed? You wrote:

I am using Packages for installing

You mean the third-party app that creates an installer package? If so, are you running your daemon by installing a launchd property list in /Library/LaunchDaemons?

Share and Enjoy

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

Hi Quinn,

Well, maybe yes, my "daemon", allow me :) is started by launchd, the plist is correctly set to /library/launchdaemons, system restart and it will start with the OS. For close I will launchctl load or unload to stop. And yes, Packages is a 3rd party app to create installer package (free).

That said all seems to work but I am not sure on how it would work when uninstalling. Today I will prepare the installer and give a try but I dont see a way to remove it, unless MacOS is very clever and somehow knows that once we move the app to trash it will also move the daeamon...

Thanks

unless macOS is very clever and somehow knows that once we move the app to trash it will also move the daeamon

Oh, it’s not that clever.

Actually, it is smart enough to do that if your app has an embedded system extension, which is kinda like a launchd daemon. However, all bets are off when you use an installer. macOS has no way to know that these components are related.

Folks generally solve this by shipping an uninstaller.

Share and Enjoy

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

Hi, Into my app I will run the launchctl to load/unload the daemon, so I have how to control it properly.

About shipping an uninstaller, as I never saw such thing (i am new user for macOs, even working with Xcode since 2020 this is not my main computer) so I will think about.

Thanks for your tip!!

Application running a daemon, what about uninstalling?
 
 
Q