4

Sometimes I see that firing the command doesn't load the app at all. This happens rarely but are there any known conditions or situations where this command would fail? Is there any way to debug launchctl?

launchctl load /Library/LaunchAgents/com.xyz.plist

The contents of the plist are:

<dict>
<key>Label</key>
<string>com.xyz</string>
<key>ProgramArguments</key>
<array>
    <string>/Applications/xyz.app/Contents/MacOS/xyz</string>
</array>
<key>EnvironmentVariables</key>
<dict>
    <key>OPT</key>
    <string>xyz</string>
</dict>
<key>ExitTimeOut</key>
<integer>10</integer>
<key>KeepAlive</key>
<dict>
    <key>SuccessfulExit</key>
    <false/>
</dict>
<key>RunAtLoad</key>
<true/>
<key>EnableTransactions</key>
<false/>

launchctl dumpstate shows STATE=WAITING. Why?

Any help will be appreciable.

ZestyZest
  • 911
  • 13
  • 27

1 Answers1

1

Depending on your version of OS X (the breaking point is 10.10, apparently) I've dug up a bunch of resources that should help you debug it, one way or another.

Also... depending on your hardware... I am not joking at all here... "have you tried turning it off and on again?" I've experienced awful Mac Server machines that simply ruin your day by having random errors that magically go away with a reboot.

Community
  • 1
  • 1
starlocke
  • 3,407
  • 2
  • 25
  • 38
  • 1
    hi, as you know launchctl log doesnt work on latest OSX 10.11 and above. Rebooting the system does load the app but sometimes randomly the app doesnt come up. Is it really unexplainably random or is there a way to know if there was an error in system that caused it? – ZestyZest Oct 31 '15 at 02:46
  • It's actually more time effective to setup something to monitor whether or not "the app" is dead or alive and react accordingly, for example, using "nagios" (or similar). To totally debug the issue tends to consume far more time than most bosses care to spend. You'd be better off with a virgin OS X and virgin hardware and rebuilding from scratch, too. Alternatively, pick a solid Linux distribution; CentOS or Debian for example. – starlocke Nov 02 '15 at 15:48