How to run a non-brew app on startup in macOS Sierra I had to install an older version of Elasticsearch (2.3.3) from source.  The binary is located in /opt/local/elasticsearch-2.3.3/bin/ I created the following file

/Library/LaunchDaemons/org.elasticsearch.plist

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple Computer//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;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;UserName&lt;/key&gt;
        &lt;string&gt;root&lt;/string&gt;
&lt;!--         &lt;key&gt;GroupName&lt;/key&gt;
        &lt;string&gt;staff&lt;/string&gt; --&gt;
        &lt;key&gt;WorkingDirectory&lt;/key&gt;
        &lt;string&gt;/opt/local/elasticsearch-2.3.3/bin&lt;/string&gt;
        &lt;key&gt;KeepAlive&lt;/key&gt;
        &lt;true/&gt;
        &lt;key&gt;RunAtLoad&lt;/key&gt;
        &lt;true/&gt;
    &lt;/dict&gt;
&lt;/plist&gt;


I then issue the following command:

sudo launchctl load -w /Library/LaunchDaemons/org.elasticsearch.plist


When I inquire with sudo launchctl list | grep elastic it returns org.elasticsearch.  But when I check if elasticsearch is running with ps ax | grep elastic it is not running.

Is there something wrong with my .plist file?
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.