How to run a non-brew app on startup in macOS Sierra
Elasticsearch mustn't be run as root. So remove the plist from the launchd database, move the plist to /Library/LaunchAgents (or ~/Library/LaunchAgents), create /opt/local/var and modify it slightly:

&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;EnvironmentVariables&lt;/key&gt;
    &lt;dict&gt;
        &lt;key&gt;VAR&lt;/key&gt;
        &lt;string&gt;VAL&lt;/string&gt;
    &lt;/dict&gt;
    &lt;key&gt;KeepAlive&lt;/key&gt;
    &lt;false/&gt;
    &lt;key&gt;Label&lt;/key&gt;
    &lt;string&gt;org.elasticsearch&lt;/string&gt;
    &lt;key&gt;ProgramArguments&lt;/key&gt;
    &lt;array&gt;
        &lt;string&gt;/opt/local/elasticsearch-2.3.3/bin/elasticsearch&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/org.elasticsearch.stderr&lt;/string&gt;
    &lt;key&gt;StandardOutPath&lt;/key&gt;
    &lt;string&gt;/tmp/org.elasticsearch.stdout&lt;/string&gt;
    &lt;key&gt;WorkingDirectory&lt;/key&gt;
    &lt;string&gt;/opt/local/var&lt;/string&gt;
&lt;/dict&gt;
&lt;/plist&gt;


Then check /opt/local/elasticsearch-2.3.3 and its subdirs for proper permissions, add EnvironmentVariables if necessary (or remove the key &amp; dict) and load the plist.

If everything works properly you may remove StandardErrorPath and StandardOutPath and their strings.



You may also run it as daemon but with a different user then (i.e. your user name) - depends on your needs/environment.