Disabled key in launchd plists

René J.V. Bertin rjvbertin at gmail.com
Sat Sep 17 09:58:27 UTC 2022

Ryan Schmidt wrote on 20220916::21:30:28 re: "Re: Disabled key in launchd plists"

>My reading of the documentation is that the system will start any launchd plists at system startup time that are in the standard LaunchDaemons directories and that are not disabled.

That's possible, but it could be that it's done via launchctl. Academic difference, probably.

>As I said, we don't want things the user installed with MacPorts to start unexpectedly at system startup time.

That would depend a bit on what kind of service, no, and to what extent the unexpected load isn't that because documented? BTW, launch *agents* would only be started when a user logs in. That, in a sense, is a trickier situation. A MacPorts user is an admin, in principle, so in a situation to decide on installing ports that contain a system daemon (which could perform a crucial but strictly MacPorts-specific function). Deciding whether or not other users on that system should run the same agents as him/her is another thing.

I'm not familiar with `port load`; I presume (hope...) that it's unambiguous as to the difference between agents and daemons, that the former have to be started as the user, the latter "sudo" etc.

>I don't know if you can specify a directory to launchctl to have it load all plists in a directory.

I only noticed that yesterday too, first from looking through the sources and then confirmed it in the manpage. It makes sense.

> If the plist is not in a standard LaunchDaemons directory, I assume that would load the plist immediately, but not at future system startups. Since that would be an undesirable situation I haven't ever tested it.

Why is that undesirable? As far as I see, the whole system is designed this way. It works for agents (at least the ones symlinked in /Library/LaunchAgents get started again after logging in, AFAIHS) but it would make even more sense for daemons. You start (load) them once and they keep running to perform the background service you (sometimes) want. You just have to be aware of it.
It's true that Apple could have foreseen a way to load either type temporarily.

Or I could be wrong, the documentation isn't exactly without ambiguities (it says "Note that per-user configuration files (LaunchAgents) must be owned by the user loading them." which is clearly not true if they did not forget to specify that this applies only to the ones in ~/Library/LaunchAgents).

I could reboot my system to test a few of these assumptions but somehow that annoys me :)


More information about the macports-dev mailing list