[launchd-dev] Disabling of launchd job if program is missing

Jerry Krinock jerry at ieee.org
Tue Jul 6 06:26:35 PDT 2010


> On Tue, Jul 6, 2010 at 10:29 AM, Vera Tkachenko <ivira at macpaw.com> wrote:
>> 
>> When user deletes this tool (e.g. after incorrect uninstall of program),
>> then launchd fails to find tool and … the following error is logged:
>> 
>> com.apple.launchd.peruser.501[224] (<job label>[89736]) posix_spawn(<path to tool>, ...): No such file or directory

Every ten seconds!

>> Why it just don't disable this job?

That's a "damned good question".

>> is it possible to configure it somehow to disable job if
>> it's tool is missing?

Certainly one would expect a simple algorithm which would cause it to back off and then warn the user and give up after awhile, not continue to try every ten seconds until eternity.

>> This is not just my software problem. Lots of other programs have such issues.

Yes.

On 2010 Jul 06, at 04:27, Dreamcat4 wrote:

> If Launchd doesnt cover it,

That's the problem.  launchd does not cover it.

> then can be fixed by doing some extra
> work. For example:
> 
> 1) … Instead of invoking the tool directly, … runner script …
> installed to an less apparent location …

Well, that might be better but the runner script could be deleted too.

> 2) … uninstall option in the .pkg installer …
> 
> 3)  … Menu item in GUI app to uninstall the launchd service.

Indeed, when I thought about this problem a few weeks ago, an uninstaller was the only I could think of.  However, many Mac users don't look for nor expect that an uninstaller is necessary.  Sure you can make it easy to find, as suggested by Dreamcat4, but it's still a pain.  And for people who uninstall your app without running the uninstaller, you should make a separate uninstaller script download available to to them.  It's a pain.

I believe that this is the classic problem of "painting yourself into a corner".  When you write an app using launchd, launchd becomes part of your app, and it should have some cleanup mechanism built into it.  Could/should we file a bug on this?  Should we file on the Apple Bug Reporter or is launchd not supported by Apple because it's "open source"?

Jerry



More information about the launchd-dev mailing list