Server Fault is a question and answer site for system and network administrators. 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

Can launchd on OSX (specifically Mountain Lion) be configured to work like watchdog, monitoring processes, after having launched them, to keep them alive? If so, how?

share|improve this question

Create a .plist file telling launchd what to launch, when to launch it, and what to do when it exits. Here's a very simple example:

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

There are lots more options; see Apple's developer docs and the launchd.plist man page. Once the file is created, place it in /Library/LaunchDaemons/local.someidentifier.plist (note that the filename should match the "Label" entry). Set its owner to root, group to wheel, and permissions to 644. It'll be loaded when you restart the computer, or you can load it manually with sudo launchctl load /Library/LaunchDaemons/local.someidentifier.plist

share|improve this answer

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.