 macOS | Services | Launchd | WSO2

How to Use launchd to Run Services in macOS

Introduction to manage macOS service with examples.

Kosala Sananthana
The Startup
Published in
5 min readMay 29, 2019

--

In computing, launchd, a unified operating system service management framework, starts, stops and manages daemons, applications, processes, and scripts in macOS. It was introduced with Mac OS X Tiger and is licensed under the Apache License.— Wikipedia

If you’ve familiar with any version of Linux, surely you have worked with cron jobs. Basically, launchd is the cron in macOS. Other than executing scripts cron-style, launchd does a lot more. Like systemd on Linux, launchd is a replacement for a lot of old school Unix tools, like init, inetd, cron, etc.

At it’s core, launchd distinguishes daemons and agents. Daemons are system-wide services that always run in the background, while agents describe regular services that are to be executed on user-specific events. Daemons and agents are managed by launchd framework which can be controlled using the launchctl terminal command.

There are two main components in the launchd service creating process that you will need to follow.

  1. Job Definition : Define the service in special XML file.
  2. Operations : Control the service using command line…

--

--

The Startup
The Startup

Published in The Startup

Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +772K followers.

Kosala Sananthana
Kosala Sananthana

Written by Kosala Sananthana

PhD Student @ AχL — Monash University | Former Senior Software Engineer @ WSO2 Inc. | Writer @ The Startup/Better Programming/Towards Data Science

Responses (3)