Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been trying to configure a nightly backup job on my Mac Mini server, and after a lot of Googling and digging and man-page'ing, I figured out that launchd seemed to be the correct too, and tried setting up my own plist fil. I've come up with this (stored in /Library/LaunchDaemons/dk.revealit.NightlyRSyncBackup.plist):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">

Problem is, it doesn't work. I can load it with launchctl, and it appears on launchctl list with exit status 0. But if I check my backup files, they are not updated.

Any clues as to what I'm doing wrong (assuming my backup script works as it should)?

share|improve this question
What does /var/root/run-rsync contain ? – Mark Feb 26 at 17:50
up vote 4 down vote accepted

Several things come to mind:

  • Did you wait overnight for it to run? launchctl load won't make it run out of sequence -- if you want to make it run at some time other than 3:15 am, use sudo launchctl start dk.revealit.NightlyRSyncBackup after it's loaded.

  • Does the run-rsync script fire off any background processes, or does it do everything inline? 'Cause if the script exits and there are background processes still going, launchd thinks something has gone wrong and kills the background processes. If you don't want it to do this, add <key>AbandonProcessGroup</key><true/> to the .plist.

  • Does the script depend on PATH including any nonstandard directories (e.g. /opt/local/bin or something like that)?

One useful debugging technique is to add something like:


to the .plist and see what shows up in those files.

share|improve this answer
As it turns out, it was an issue with the SSH-key not being read properly when run via launchd. Your tip with StandardOutPath and StandardErrorPath were invaluable in finding that problem, thanks :) – mikl Jul 14 '11 at 14:32

Once answered a similiar qst, so check this first:

from the man lanuchctl

Note that per-user configuration files (LaunchAgents) must be owned by the user loading them. All system-wide daemons (LaunchDaemons) must be owned by root. Configuration files must not be group- or world-writable. These restrictions are in place for security reasons, as allowing writability to a launchd configuration file allows one to specify which executable will be launched.

So, if your rsync should be stared as root

chown root  /Library/LaunchDaemons/your.plist 
chgrp wheel /Library/LaunchDaemons/your.plist 
chmod 644   /Library/LaunchDaemons/your.plist

and after these:

launchctl load /Library/LaunchDaemons/your.plist
share|improve this answer
That was a good tip, but the ownership/permissions were okay already :) – mikl Jul 14 '11 at 14:31
two weeks old question - still not working? that's must be something really weird problem... – jm666 Jul 14 '11 at 16:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.