I have launchd configured to run a script. This works fine for the user who installed it (me), but it relaunches the script every time I log in, while I'd like it to run as long as the computer is on (like a windows service).

Details - Location:



<plist version="1.0">
  • Are you sure it's in /Library/LaunchDaemons? The behavior you describe sounds like it's in /Library/LaunchAgents instead. – Gordon Davisson Jul 15 '12 at 17:21
  • Yes, I loaded it with launchctl load /Library/LaunchDaemons/com.pluuserwatcher.osx.test.plist – Maxim Khesin Jul 15 '12 at 18:19

If you load the launchd item by running launchctl load ... as a normal user, it loads it for your user launchd instance (i.e. essentially as a LaunchAgent, so it only runs within your user login sessions. To load it into the system launchd (as a proper LaunchDaemon), use sudo launchctl load ... (or just put it in /Library/LaunchDaemons and reboot).

  • Thanks - it appears to work! Unfortunately I can't upvote for lack of reputation points :( – Maxim Khesin Jul 16 '12 at 0:20
  • @MaximKhesin: Great! Since it worked, please mark this as the "accepted" answer (see the instructions here). – Gordon Davisson Jul 16 '12 at 2:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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