6

I have created the plist and placed it in /System/Library/LaunchAgents/. However, when I reboot my Mac it does not load like it is expected to. I am able to load it from the Terminal with launchctl load and unload commands and it is perfectly loaded from there. And also I have checked the console after reboot and it does not have any entry related to the plist.

How can I get this plist to run on boot?

2
  • 1
    Let's see the plist
    – mmmmmm
    Commented Oct 16, 2013 at 10:55
  • See answers to this other question: superuser.com/a/832673 what worked for me was using the chmod 600 (or chmod 644) and chown root. Commented Mar 31, 2020 at 19:10

1 Answer 1

7

Is the property list owned by root? If it is not, it is not loaded on login even if launchctl load (without sudo) would load it.

$ sudo launchctl load /Library/LaunchAgents/test.plist 
launchctl: Dubious ownership on file (skipping): /Library/LaunchAgents/test.plist
nothing found to load
$ sudo chown root /Library/LaunchAgents/test.plist 
$ sudo launchctl load /Library/LaunchAgents/test.plist 
$ 

If the program is meant to be run when the property list is loaded, set RunAtLoad to true:

<key>RunAtLoad</key>
<true/>

Also you can normally use /Library/LaunchAgents/ instead of /System/Library/LaunchAgents/. From man launchd:

~/Library/LaunchAgents         Per-user agents provided by the user.
/Library/LaunchAgents          Per-user agents provided by the administrator.
/Library/LaunchDaemons         System-wide daemons provided by the administrator.
/System/Library/LaunchAgents   Per-user agents provided by Mac OS X.
/System/Library/LaunchDaemons  System-wide daemons provided by Mac OS X.

Not the answer you're looking for? Browse other questions tagged .