Launch Daemon for NodeJS App Won't start on reboot I've created the below launch daemon to run a nodejs program on startup (tiddlywiki in this case):
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;
&lt;plist version=&quot;1.0&quot;&gt;
    &lt;dict&gt;
        &lt;key&gt;Debug&lt;/key&gt;
        &lt;true/&gt;
        &lt;key&gt;StandardOutPath&lt;/key&gt;
        &lt;string&gt;/tmp/tiddlywiki.stdout&lt;/string&gt;
        &lt;key&gt;StandardErrorPath&lt;/key&gt;
        &lt;string&gt;/tmp/tiddlywiki.stderr&lt;/string&gt;
        &lt;key&gt;Label&lt;/key&gt;
        &lt;string&gt;com.activescott.tiddlywiki&lt;/string&gt;
        &lt;key&gt;OnDemand&lt;/key&gt;
        &lt;false/&gt;
        &lt;key&gt;RunAtLoad&lt;/key&gt;
        &lt;true/&gt;
        &lt;key&gt;KeepAlive&lt;/key&gt;
        &lt;true/&gt;
        &lt;key&gt;inetdCompatibility&lt;/key&gt;
        &lt;dict&gt;
            &lt;key&gt;Wait&lt;/key&gt;
            &lt;true/&gt;
        &lt;/dict&gt;
        &lt;key&gt;EnvironmentVariables&lt;/key&gt;
        &lt;dict&gt;
            &lt;key&gt;PATH&lt;/key&gt;
            &lt;string&gt;/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:&lt;/string&gt;
        &lt;/dict&gt;
        &lt;key&gt;ProgramArguments&lt;/key&gt;
        &lt;array&gt;
            &lt;string&gt;/Volumes/minidata/Dropbox/tiddlywiki/node_modules/.bin/tiddlywiki&lt;/string&gt;
            &lt;string&gt;/Volumes/minidata/Dropbox/tiddlywiki/wiki&lt;/string&gt;
            &lt;string&gt;--listen&lt;/string&gt;
            &lt;string&gt;credentials=creds.csv&lt;/string&gt;
            &lt;string&gt;writers=scott&lt;/string&gt;
            &lt;string&gt;readers=scott&lt;/string&gt;
            &lt;string&gt;port=443&lt;/string&gt;
            &lt;string&gt;host=0.0.0.0&lt;/string&gt;
            &lt;string&gt;tls-key=key.pem&lt;/string&gt;
            &lt;string&gt;tls-cert=server.crt&lt;/string&gt;
        &lt;/array&gt;
    &lt;/dict&gt;
&lt;/plist&gt;

The file is named com.activescott.tiddlywiki.plist and it is in the /Library/LaunchDaemons/ folder.
If I load it with the command:
sudo launchctl load -Fw /Library/LaunchDaemons/com.activescott.tiddlywiki.plist

I start it with the below command it and wills tart and work fine - it just doesn't restart automatically when the comp reboots:
sudo launchctl start com.activescott.tiddlywiki

Note, it does take about ~20s to fully start (e.g. respond on a port and write to stdout).
I'm on Mac OS X, 10.13.6 w/ BuildVersion 17G13035
Update:
After a reboot I noticed that the output of sudo launchctl list com.activescott.tiddlywiki shows LastExitStatus as 19968. This value will show 0 if I start it with launchctl. Below is the full output:
{
        &quot;StandardOutPath&quot; = &quot;/tmp/tiddlywiki.stdout&quot;;
        &quot;LimitLoadToSessionType&quot; = &quot;System&quot;;
        &quot;StandardErrorPath&quot; = &quot;/tmp/tiddlywiki.stderr&quot;;
        &quot;Label&quot; = &quot;com.activescott.tiddlywiki&quot;;
        &quot;TimeOut&quot; = 30;
        &quot;OnDemand&quot; = true;
        &quot;LastExitStatus&quot; = 19968;
        &quot;Program&quot; = &quot;/Volumes/minidata/Dropbox/tiddlywiki/node_modules/.bin/tiddlywiki&quot;;
        &quot;ProgramArguments&quot; = (
                &quot;/Volumes/minidata/Dropbox/tiddlywiki/node_modules/.bin/tiddlywiki&quot;;
                &quot;/Volumes/minidata/Dropbox/tiddlywiki/wiki&quot;;
                &quot;--listen&quot;;
                &quot;credentials=creds.csv&quot;;
                &quot;writers=scott&quot;;
                &quot;readers=scott&quot;;
                &quot;port=443&quot;;
                &quot;host=0.0.0.0&quot;;
                &quot;tls-key=key.pem&quot;;
                &quot;tls-cert=server.crt&quot;;
        );
};
Presuming your application can be run within the Terminal, making an AppleScript program (using Script Editor) containing the commands that you would run in the terminal and then exporting that program as a Run-Only Application, placing it in your /Applications/ directory can create your program launcher.
There is a helpful answer on using do shell script in AppleScript here.
AppleScript Example: Running hdiutil to mount a sparseimage bundle as a Time Machine backup drive
do shell script &quot;hdiutil attach /Volumes/NewVolumeD/TimeMachine.sparsebundle&quot;

Then, navigating to System Preferences &gt; Users &amp; Groups &gt; (your account) &gt; Login Items, unlocking the settings menu and then using the + button on the bottom left to select your launcher application from Applications. That launcher will now run on login, check mark on Hide so that it doesn't throw unwanted messages.
Alternatively, you could make a zsh or bash script and tell AppleScript execute the shell script (given its absolute path) instead of specifying each command in AppleScript itself.
EDIT: Instead of using Login Items, you can place the Application Bundle in /Library/StartupItems (though it is deprecated) if you want it to launch on startup instead of login.