On Sep 15, 2022, at 11:01, René J.V. Bertin wrote:
> 
> On Thursday September 15 2022 10:07:24 Ryan Schmidt wrote:
>> 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
> 
> Or the user logs in, for agents. That's what I thought too until recently, 
> but the manpage also says 
> 
> "This document details the parameters that can be given to an XML property 
> list that can be loaded into launchd with launchctl."
> 
> The launchd manpage confirms this by stating that
> "The primary and preferred interface to launchd is via the launchctl(1) tool 
> which (among other options) allows the user or administrator to load and 
> unload jobs."
> 
> But it also says 
> 
> "Where possible, it is preferable for jobs to launch on demand based on 
> criteria specified in their respective configuration files."

Yes, to all of that, but none of that really relates to the question you asked 
about the Disabled key.

> which could imply that jobs can get loaded by simply being in the proper 
> directory.

Indeed Apple believes it is more efficient if you write launchd plists that 
work "on demand", that is to say, they specify under what conditions they 
should launch (e.g. when a connection comes in on a particular network port or 
when a file appears in a particular directory or at a particular time of day) 
and launchd then arranges for that to happen. launchd plists created by the 
MacPorts startupitem keyword to not do this* but manually-written plists that 
ports may install could do that if desired.

Merely being placed in a directory does not cause a launchd plist to be loaded.

Loading a launchd plist does not necessarily mean that a process will run. It 
just means that it is then possible for the OS to run the process under 
whatever conditions the launchd plist specifies. MacPorts-created launchd 
plists will indeed start a process running the moment they are loaded, but 
plists coded to be "on demand" would not necessarily if their launch conditions 
had not been met.

*
https://trac.macports.org/ticket/13807
https://trac.macports.org/ticket/60654


>> , but we want the plists our ports install to be disabled until the user 
>> enables them.
> 
> But would launchd even look where MacPorts installs these plists? I suppose 
> it doesn't...

MacPorts places symlinks to its launchd plists in /Library/LaunchDaemons so 
that launchd can find them. This has been working fine ever since launchd 
support was added to MacPorts for the release of Tiger over 17 years ago.


Reply via email to