Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I wrote a little script to automatically update my Network Location based on a couple of conditions, and have coupled that with a launchd plist to have it run every couple of minutes.

However, I've noticed that my launchd plist doesn't seem to get loaded when my computer reboots. My plist is in ~/Library/LaunchDaemons and is fairly simple:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.davedelong.location-updater</string>
    <key>Program</key>
    <string>/path/to/my/location_updater.rb</string>
    <key>StartInterval</key>
    <integer>180</integer>
</dict>
</plist>

My LaunchDaemons folder has the expected 700 permissions, and running launchctl load with my plist makes things work just fine. It's just that when I reboot, it's not getting loaded.

I was under the impression that everything in ~/Library/LaunchDaemons and ~/Library/LaunchAgents got loaded automatically by launchd. Is this not the case? If this is the case (and I think it is), then why isn't my plist getting loaded?

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

~/Library/LaunchDaemons isn't a valid location for either launch agents or launch daemons. You are misunderstanding the terminology. LaunchDaemons are system-wide processes, while LaunchAgents are run per-user. From the launchd man page:

~/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.

Move your plist to ~/Library/LaunchAgents, and it should just work.

share|improve this answer
    
Aha. Documentation to the rescue! –  Dave DeLong Nov 5 '11 at 4:11
add comment

Your Answer

 
discard

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.