Launchd agent not starting

Posted by Thomi on Stack Overflow See other posts from Stack Overflow or by Thomi
Published on 2010-03-16T16:22:50Z Indexed on 2010/03/17 1:41 UTC
Read the original article Hit count: 476

Filed under:
|
|
|

I'm attempting to write a launchd agent that runs a simple application for every user that logs in to the Mac OS X system.

I have created a file named com.mycompany.myapp.plist and placed it in /Library/LaunchAgents. The contents of that file are:

{
    LimitLoadToSessionType = "Aqua";
    StartInterval = 10;
    OnDemand = NO;
    KeepAlive = YES;
    RunAtLoad = YES;
    Label = "com.mycompany.myapp";
    Program = "/Users/thomi/myapp";
    ProgramArguments = (
        "/Users/thomi/myapp",
        "-l",
        "-d",
    );
}

Initially I didn't have the StartInterval key set, since I thought the agent would start automatically. The problem is that the agent does not start unless I manually issue the following two commands:

launchctl load -S Aqua -D all
launchctl start com.mycompany.myapp

Firther, when I run launchctl list com.mycompany.myapp I get the following output:

{
    "Label" = "com.mycompany.myapp";
    "LimitLoadToSessionType" = "System";
    "OnDemand" = true;
    "LastExitStatus" = 0;
    "TimeOut" = 30;
    "Program" = "/Users/thomi/myapp";
    ProgramArguments = (
        "/Users/thomi/myapp",
        "-l",
        "-d",
    );
};

Notice that the LimitLoadToSessionType parameter has changed.

Am I missing something here? Is there a different mechanism to start agents like this? Why has the LimitLoadToSessionType property changed?

© Stack Overflow or respective owner

Related posts about mac

Related posts about launchd