Launching the application as a daemon

I am writing an application which is capable of running as a regular application – with a GUI, AND as a ‘daemon’ – servicing other GUI based applets.

The user is expected to decide in which mode they want to run the application.

The questions are:

  1. Can this be done? On Windows, I am able to do this by allowing user to ‘install as a service’ and I can programmatically check if the application HAS been started as a service or not – and take the appropriate code path. What is the equivalent in MacOS?

  2. On startup, how do I check if the application is being launched in regular mode, or launched as a daemon

  3. What are the system interactions which I need to specifically hook into if it is launched as a daemon.

Launching the application as a daemon
 
 
Q