LaunchDaemon and startupitem

Joshua Root jmr at
Mon Jan 21 06:59:22 UTC 2019

On 2019-1-21 17:24 , Eric F (iEFdev) wrote:
> Hi,
> I'm thinking about LaunchDaemon. I've made a one running once a month.
> What's the best way to include it into a port. As a separate file moved
> into location, or as I've seen i some Portfiles - using “set foo [open
> …]” and “puts”, to create it in place. Are there any good praxises/rules
> to follow?
> …or can “starupitem” be used running a StartCalendarInterval, oppose to
> starting the service itself? (but to be able to use port load).

The startupitem.* options don't offer a lot of the options of launchd.
If you need something like StartCalendarInterval, the best way is
probably to create the plist and put it in the port's files directory.
You then have to install it in the right place and set a couple options
so 'port load' will find it.

See the dbus port for an example of this. It actually installs 2 plists,
one LaunchDaemon and one LaunchAgent. The former is generated in the
Portfile with puts, I think because some of the content varies depending
on OS version. The latter is from the dbus distfile.

- Josh

More information about the macports-dev mailing list