Disabled key in launchd plists

Ryan Schmidt ryandesign at macports.org
Thu Sep 15 15:07:24 UTC 2022


On Sep 15, 2022, at 08:24, René J.V. Bertin wrote:

> I've noticed that most of the launchd plists installed by ports have `Disabled: true`. There are a select few that don't, among which the mariadb server. I have that port installed, and yet no mariadb launchd job loaded which suggests that launchd does not auto-load plists, at least not from an "unsupported" location like /opt/local/Library/Launch{Agents,Daemons}.
> 
> What's the actual function of this key? Just a convenience feature so you can do `launchctl [un]load /path/to/*.plist` and only load the enabled jobs?

The Disabled key, and other keys of launchd plists, is described in the launchd.plist manpage:

https://www.manpagez.com/man/5/launchd.plist/

Apple's default value of Disabled is false, which means (according to the documentation I read) that the service will be started automatically the next time the system starts up, but we want the plists our ports install to be disabled until the user enables them. A port may have been installed for the user as a dependency; the user may have no idea that the port includes a launchd plist and probably doesn't want some process they didn't ask for to be running persistently on their computer, especially if that program opens network connections. An exception to this is ports that need to run a persistent program in order to serve their purpose and hopefully do not need a network connection in order to do it, in which case such a port would use "startupitem.autostart yes". certsync is an example of such a port.

plists installed with the MacPorts startupitem options set Disabled to true. The mariadb port does not use the MacPorts startupitem options but instead provides a pre-made plist in the port's files directory and installs that. I don't know why it has Disabled set to false.



More information about the macports-dev mailing list