Why won't my LaunchDaemon start? I'm attempting to write my first LaunchDaemon: I think it's pretty simple and meets all the requirements, but it won't run.

The file is at /Library/LaunchDaemons/com.noah.supertest.plist

Ideally, it should be running ls and writing the output to ~/test.txt. But nothing is ever written to the file.

I restarted the machine thinking that might do it, but nothing.

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
  &lt;key&gt;Label&lt;/key&gt;
  &lt;string&gt;com.noah.supertest&lt;/string&gt;

  &lt;key&gt;ProgramArguments&lt;/key&gt;
  &lt;array&gt;
    &lt;string&gt;ls&lt;/string&gt;
    &lt;string&gt;&gt;&lt;/string&gt;
    &lt;string&gt;~/test.txt&lt;/string&gt;
  &lt;/array&gt;

  &lt;key&gt;KeepAlive&lt;/key&gt;
  &lt;true/&gt;

  &lt;key&gt;StartInterval&lt;/key&gt;
  &lt;integer&gt;10&lt;/integer&gt;


  &lt;key&gt;RunAtLoad&lt;/key&gt;
  &lt;true/&gt;

&lt;/dict&gt;
&lt;/plist&gt;


Permissions are set as root:wheel
You made several errors:


It is running provided you started the plist properly with launchctl - but it's faulty
You didn't define a working directory for ls
You are missing a proper stdout
You are missing a standard error file (then it's usually easy to detect what's wrong with your agent
Put it in LaunchAgents instead of LaunchDaemons: ls is no daemon


Here is a working plist:

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
    &lt;key&gt;EnableGlobbing&lt;/key&gt;
    &lt;true/&gt;
    &lt;key&gt;KeepAlive&lt;/key&gt;
    &lt;true/&gt;
    &lt;key&gt;Label&lt;/key&gt;
    &lt;string&gt;com.noah.supertest&lt;/string&gt;
    &lt;key&gt;ProgramArguments&lt;/key&gt;
    &lt;array&gt;
        &lt;string&gt;ls&lt;/string&gt;
        &lt;string&gt;-laO&lt;/string&gt;
        &lt;string&gt;/private/tmp&lt;/string&gt;
    &lt;/array&gt;
    &lt;key&gt;RunAtLoad&lt;/key&gt;
    &lt;true/&gt;
    &lt;key&gt;StandardErrorPath&lt;/key&gt;
    &lt;string&gt;/tmp/com.noah.supertest.stderr&lt;/string&gt;
    &lt;key&gt;StandardOutPath&lt;/key&gt;
    &lt;string&gt;/Users/user_name/test.txt&lt;/string&gt;
    &lt;key&gt;StartInterval&lt;/key&gt;
    &lt;integer&gt;10&lt;/integer&gt;
&lt;/dict&gt;
&lt;/plist&gt;


You have to create the file ~/test.txt first before running the launch agent.

Then start the launch agent with sudo launchctl [subcommand [arguments ...]] and check the result:

...
drwxrwxrwt  8 root      wheel  -       272 Jan 23 12:23 .
drwxr-xr-x@ 6 root      wheel  hidden  204 Apr  9  2015 ..
-rw-r--r--@ 1 username  wheel  -      6148 Jan 23 12:21 .DS_Store
drwx------  3 root      wheel  -       102 Jan 23 12:07 KSOutOfProcessFetcher.0.sAglCyxY5lzPoNgfmEvv-ZqGl-w=
drwx------  3 username  wheel  -       102 Jan 23 12:05 com.apple.launchd.XFA6PYyYos
drwx------  3 username  wheel  -       102 Jan 23 12:05 com.apple.launchd.pHTdYNvPM9
-rw-r--r--  1 username  wheel  -      1867 Jan 23 12:21 com.noah.supertest.stderr
-rw-r--r--  1 username  wheel  -         0 Jan 23 12:16 com.soma-zone.LaunchControl.dumpstate
total 24
drwxrwxrwt  8 root      wheel  -       272 Jan 23 12:23 .
drwxr-xr-x@ 6 root      wheel  hidden  204 Apr  9  2015 ..
-rw-r--r--@ 1 username  wheel  -      6148 Jan 23 12:21 .DS_Store
drwx------  3 root      wheel  -       102 Jan 23 12:07 KSOutOfProcessFetcher.0.sAglCyxY5lzPoNgfmEvv-ZqGl-w=
drwx------  3 username  wheel  -       102 Jan 23 12:05 com.apple.launchd.XFA6PYyYos
drwx------  3 username  wheel  -       102 Jan 23 12:05 com.apple.launchd.pHTdYNvPM9
-rw-r--r--  1 username  wheel  -      1867 Jan 23 12:21 com.noah.supertest.stderr
-rw-r--r--  1 username  wheel  -         0 Jan 23 12:16 com.soma-zone.LaunchControl.dumpstate
total 24
drwxrwxrwt  8 root      wheel  -       272 Jan 23 12:23 .
drwxr-xr-x@ 6 root      wheel  hidden  204 Apr  9  2015 ..
-rw-r--r--@ 1 username  wheel  -      6148 Jan 23 12:21 .DS_Store
drwx------  3 root      wheel  -       102 Jan 23 12:07 KSOutOfProcessFetcher.0.sAglCyxY5lzPoNgfmEvv-ZqGl-w=
drwx------  3 username  wheel  -       102 Jan 23 12:05 com.apple.launchd.XFA6PYyYos
drwx------  3 username  wheel  -       102 Jan 23 12:05 com.apple.launchd.pHTdYNvPM9
-rw-r--r--  1 username  wheel  -      1867 Jan 23 12:21 com.noah.supertest.stderr
-rw-r--r--  1 username  wheel  -         0 Jan 23 12:16 com.soma-zone.LaunchControl.dumpstate
...