On Sep 15, 2022, at 14:48, René J.V. Bertin wrote:

> Ryan Schmidt wrote on 20220915::13:36:25 re: "Re: Disabled key in launchd 
> plists"
> 
>> Yes, to all of that, but none of that really relates to the question you 
>> asked about the Disabled key.
> 
> I think it does... because
> 
>> Merely being placed in a directory does not cause a launchd plist to be 
>> loaded.
> 
> means that someone has to load them explicitly.
> 
> Now I wasn't aware that you can give a directory as argument to `launchctl 
> [un]load`. Without that possibility I don't really see what the point of the 
> Disabled key is (so you have to un/load the plists concerned with -w or -F 
> ... so what?). And that's what my question was about.
> 
> 
>>> 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.
> 
> Yes, but not automatically (so I missed it for the port I'm currently 
> tinkering with). But if "Merely being placed in a directory does not cause a 
> launchd plist to be loaded" and you have to give a full path to launchctl, 
> removing those symlinks shouldn't make a difference, correct?

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.

As I said, we don't want things the user installed with MacPorts to start 
unexpectedly at system startup time. That's why we mark them disabled. The user 
opts in to loading a port's launchd plist(s) by running the "port load" command 
(or the equivalent longer launchctl command(s)). This causes the plist to be 
loaded immediately and at all future system startups. Ports that use the 
standard MacPorts startupitems mechanism print a note to the user explaining 
this when such a port is installed.

I don't know if you can specify a directory to launchctl to have it load all 
plists in a directory. In my experience, you give the absolute path of the 
plist you want to load. 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.

Reply via email to