#schedule #repeat #periodic #mac-os


Rust library for creating and parsing launchd files

3 releases (breaking)

0.3.0 Aug 8, 2023
0.2.0 Mar 26, 2021
0.1.0 Mar 23, 2021

#365 in Network programming

25 downloads per month

MIT license



A Rust library for creating and parsing Launchd files.


It's still in early development and all help is welcome.

The syntax for building launchd files is still subject for change. Launchd has a lot of properties, and I'm considering using derive_builder or something similar to reduce boilerplate code, and increase maintainability. I'm hoping to have made that decision by v0.4.0. Suggestions are welcome!

The Launchd struct is not yet complete. The fields are not public by design, so I can add (but not delete) fields through patches, without the need to create a new minor version.

This library is largely untested. This is not a huge issue for the majority of the program. The only real issue is with the cron feature.

I'm still thinking about what should happen if uninitialized CalendarIntervals are added to the struct. Should an exception be thrown, should they silently be filtered out, or should I leave that responsibility to the user. For now it's your own responsibility, but that behaviour might change in the future.


What is Launchd?

Launchd is MacOS's way of scheduling programs and services to be ran.

For more information: Wiki.

For a more detailed description of the parameters run man launchd.plist on your Apple computer or check out: manpagez or xcode-man-pages.

Why not cron?

MacOS deprecated cron, the previous way of scheduling programs.

This library also provides a way of parsing crontabs to CalendarIntervals when the cron feature is selected. Disclaimer: this feature is still untested.

Why not systemd?

Due to licensing issues MacOS does not support systemd. The parsing of systemd is not included in this library.


Add this to your Cargo.toml dependencies:

launchd = "0.3.0"



launchd = {version = "0.3.0", features=["io"]}

Translate crontabs

launchd = {version = "0.3.0", features=["cron"]}

Without the plist writer

launchd = {version = "0.3.0", default-features = false, features=["serde"]}


use std::path::Path;
use launchd::{CalendarInterval, Error, Launchd};
fn main() -> Result<(), Error> {
    let ci = CalendarInterval::default()

    let launchd = Launchd::new("LABEL", Path::new("./foo/bar.txt"))?
            .with_program_arguments(vec!["Hello".to_string(), "World!".to_string()])

Results in:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
        <true />


~37K SLoC