title: How can I add arguments to OSX launchd plist to pipe output to a log file?
body: <p>I have tried many different variation on this but just can't get it to work.</p>
  
  <p>I have a plist file:</p>
  
  <pre><code>&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.ilium007.handbrake&lt;/string&gt;
          &lt;key&gt;ProgramArguments&lt;/key&gt;
          &lt;array&gt;
                  &lt;string&gt;/bin/bash&lt;/string&gt;
                  &lt;string&gt;/Users/ilium007/support/scripts/handbrake/handbrake.sh &amp;gt;&amp;gt; /Users/ilium007/support/scripts/handbrake/logs/handbrake_encode.log&lt;/string&gt;
                  &lt;!--&lt;string&gt;&amp;gt;&amp;gt;&lt;/string&gt;--&gt;
                  &lt;!--&lt;string&gt;/Users/ilium007/support/scripts/handbrake/logs/handbrake_encode.log&lt;/string&gt;--&gt;
          &lt;/array&gt;
          &lt;key&gt;RunAtLoad&lt;/key&gt;
          &lt;true/&gt;
          &lt;key&gt;StartInterval&lt;/key&gt;
          &lt;integer&gt;60&lt;/integer&gt;
  &lt;/dict&gt;
  &lt;/plist&gt;
  </code></pre>
  
  <p>Note the comments in there.</p>
  
  <p>I want to pipe output from the handbrake.sh script to a log file and have tried to do so but keep getting A "no such file" error in system.log on OSX.</p>
  
  <pre><code>Nov  3 18:03:54 macmini com.ilium007.handbrake[15348]: /bin/bash: /Users/ilium007/support/scripts/handbrake/handbrake.sh &gt;&gt; /Users/ilium007/support/scripts/handbrake/logs/handbrake_encode.log: No such file or directory Nov  3 18:03:54 macmini com.apple.launchd.peruser.501[162] (com.ilium007.handbrake[15348]): Exited with code: 127
  </code></pre>
  
  <p>If I change the plist to the following, it runs but I get no log so I assume it is only running the first argument:</p>
  
  <pre><code>&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.ilium007.handbrake&lt;/string&gt;
          &lt;key&gt;ProgramArguments&lt;/key&gt;
          &lt;array&gt;
                  &lt;string&gt;/bin/bash&lt;/string&gt;
                  &lt;string&gt;/Users/ilium007/support/scripts/handbrake/handbrake.sh&lt;/string&gt;
                  &lt;string&gt;&amp;gt;&amp;gt;&lt;/string&gt;
                  &lt;string&gt;/Users/ilium007/support/scripts/handbrake/logs/handbrake_encode.log&lt;/string&gt;
          &lt;/array&gt;
          &lt;key&gt;RunAtLoad&lt;/key&gt;
          &lt;true/&gt;
          &lt;key&gt;StartInterval&lt;/key&gt;
          &lt;integer&gt;60&lt;/integer&gt;
  &lt;/dict&gt;
  &lt;/plist&gt;
  </code></pre>
  
  <p>The command that I would like to run via launchd is:</p>
  
  <pre><code>/Users/ilium007/support/scripts/handbrake/handbrake.sh &gt;&gt; /Users/ilium007/support/scripts/handbrake/logs/handbrake_encode.log
  </code></pre>
  
  <p>Nothing ever appears in the log file. But if I run that command from the terminal I get content in the log. Any help would be appreciated.</p>