Skip to content

mheily/relaunchd

Repository files navigation

relaunchd

Linux CI Coverity CodeQL

Overview

relaunchd is an open-source service manager that is similar to the launchd(8) system found in macOS.

It was written from scratch based on the published API, and all code is available under the ISC license. See the LICENSE file for more information.

It is currently under development, and should not be used for anything important. Be especially mindful that there is NO WARRANTY provided with this software.

Status

See the release notes for details about the current release.

relaunchd has been built on the following platforms:

  • OpenBSD 7.2
  • FreeBSD 13.1-RELEASE
  • CentOS Stream 8
  • Alpine Linux
  • Ubuntu Linux
  • MacOS Ventura

The core functionality is working:

  • loading and unloading jobs with launchctl
  • launching jobs
  • periodic jobs that use the StartInterval key

Some things are not implemented yet, such as:

  • StartCalendar cron emulation
  • file and directory watches
  • resource limits
  • LaunchOnlyOnce
  • inetdCompatibility

Some things will probably never be implemented:

  • oddities - LimitLoadToHosts, LimitLoadFromHosts
  • kernel and launchd debugging - Debug, WaitForDebugger
  • Mach IPC
  • the StartOnMount key - may require kernel support for filesystem mount notifications
  • hacks and workarounds - HopefullyExitsFirst, HopefullyExitsLast
  • Darwin-specific things - EnableTransactions

Building from source

CMake is currently the primary build system, but there is a Makefile-based buildsystem under development.

When building on FreeBSD, run the following command to install dependencies:

# pkg install nlohmann-json git cmake

Required library dependencies:

  • nlohmann::json (apt install nlohmann-json3-dev on Debian/Ubuntu, or brew install nlohmann-json on MacOS)

If you are not able to install nlohmann::json in a systemwide location, you can tell CMake to download and use a private copy. Add the following flag to your CMake invocation:

-DUSE_PRIVATE_NLOHMANN_JSON=YES

If you are using an older version of GCC, such as the one found in CentOS Stream 8, you will need to enable linking against the external std::filesystem library. Add the following flag to your CMake invocation:

-DUSE_EXTERNAL_CXX17_FILESYSTEM=YES

The basic commands to build and install the software are:

	mkdir cmake-build-debug
	cd cmake-build-debug
	cmake ..
	make

Generating a code coverage report

To generate a code coverage report, run the following:

./create-coverage-report.sh

Installation

To install relaunchd, run the following command in the build directory:

sudo make install

This will install the following executable commands:

  • launchd
  • launchctl

It will also install the following manpages:

  • launchctl(1)
  • launchd(8)
  • launchd.plist(5)

Usage

After installing relaunchd, you can start the daemon by simply running launchd.

Sanitizers

Currently, only ASAN is supported. To enable ASAN, add the option -DENABLE_ASAN=YES when calling CMake.

Static Analysis

Coverity scan reports for relaunchd are available.

Contact Information

For questions, comments, or other feedback about relaunchd, please open an issue on the GitHub page.

Links

Here are some links to useful information about launchd:

References

[1] https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man8/launchd.8.html