diff --git a/CronosAgent.c b/CronosAgent.c
index 644f07b..14576e6 100644
--- a/CronosAgent.c
+++ b/CronosAgent.c
@@ -27,6 +27,8 @@
 #endif
 
 #ifdef __MACH__
+#include <launch.h>
+#include <stdbool.h>
 #include <sys/event.h>
 #include <mach/mach.h>
 #include <mach/clock.h>
@@ -66,10 +68,13 @@
 #define CAST(type, value)  const_cast<type>(value)
 #else
 #define CAST(type, value)  (type)value
+
+#ifndef bool
 #define bool               int
 #define true               1
 #define false              0
 #endif
+#endif
 
 #ifdef __linux__
 #define CHECK(event, handle)  (event->data.fd == handle)
@@ -216,9 +221,7 @@ int main(int argc, const char* argv[])
       "    --service-mode <set of bits>\n"
       "        bit 0 - print to standard output\n"
       "        bit 1 - print to system log\n"
-#ifdef __linux__
       "        bit 2 - run as daemon\n"
-#endif
       "\n",
       argv[0]);
     return EXIT_FAILURE;
@@ -232,6 +235,32 @@ int main(int argc, const char* argv[])
     return EXIT_FAILURE;
   }
 #endif
+#ifdef __MACH__
+  if (serviceMode & MODE_DAEMON)
+  {
+    launch_data_t request = launch_data_new_string(LAUNCH_KEY_CHECKIN);
+    launch_data_t response = launch_msg(request);
+    launch_data_free(request);
+    if (response == NULL)
+    {
+      print("Error calling launchd");
+      return EXIT_FAILURE;
+    }
+    launch_data_type_t type = launch_data_get_type(response);
+    launch_data_free(response);
+    if (type == LAUNCH_DATA_ERRNO)
+    {
+      print("launchd returned error %d\n", launch_data_get_errno(response));
+      return EXIT_FAILURE;
+    }
+    // launchd will return dictionary of job for successful check-in
+    if (type != LAUNCH_DATA_DICTIONARY)
+    {
+      print("Error launching daemon");
+      return EXIT_FAILURE;
+    }
+  }
+#endif
 
   // Resolve server address