If a plist is owned by root and writable by a user other than root, that's a security issue.
You can change the owner to root with sudo chown root <filename>
, and change the permissions with sudo chmod 644 <filename>
(4 for read access, 2 for write access, 1 for execute access, added up. The first number is for the owner, the second for the group, the third for everyone.)
You must specify the full path in ProgramArguments. Things which your shell normally expands, such as ~
and *
are not expanded by launchd
.
After making those changes, this LaunchAgent worked for me.
You said you made these changes, but it didn't fix it. It is possible that you did not reload the LaunchAgent after making the changes.
Troubleshooting LaunchAgents
You can check if your LaunchAgent is currently loaded by running
launchctl list | grep com.nocturnal.mcworldsBackup
If it is not running, you can load it by using
launchctl load ~/Library/LaunchAgents/com.nocturnal.mcworldsBackup.plist
If you make any changes to the plist file, you will need to unload it using
luanchctl unload ~/Library/LaunchAgents/com.nocturnal.mcworldsBackup.plist
You will then need to load it again, using the command from above.
If you want to force the LaunchAgent to start now, instead of waiting until 4:30, you can run
launchctl start com.nocturnal.mcworldsBackup
You can then list it using
launchctl list | grep com.nocturnal.mcworldsBackup
The first column of the result is the PID of the process, if it is currently running. The second column is the exit code returned last time it was run. Use this to check if it ran properly. If not, the error message is written to /var/log/system.log
.
Best Answer
It's possibly because you grep'ed for a different file than you tried to load (hosts_unBlocksites_AM.plist vs. hosts_Blocksites_AM.plist), but also note that root has its own list of launch agents and when you run
sudo launchctl list
you will see root's list, which is different fromlaunchctl list
which will show yours.So this should work (depending on what you're trying to do in your launch agent):
If needed, run both as sudo (not just one of them).