Last active
January 23, 2024 22:50
-
-
Save natcl/4688162920f368707613 to your computer and use it in GitHub Desktop.
Node-Red launchd script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd > | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>org.nodered.plist</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/usr/local/bin/node</string> | |
<string>/usr/local/bin/node-red</string> | |
<string>-v</string> | |
</array> | |
<key>RunAtLoad</key> | |
<true/> | |
<key>KeepAlive</key> | |
<true/> | |
<key>StandardOutPath</key> | |
<string>/Users/YOURUSER/.node-red/node-red.log</string> | |
<key>WorkingDirectory</key> | |
<string>/Users/YOURUSER/.node-red</string> | |
</dict> | |
</plist> |
Thanks, @NatCi.
One question: When launchctl launches node-red I get the following error in the node-red.log file:
4 Feb 22:29:36 - [info] Palette editor disabled : npm command not found
When I run node-red from the command line I don't. Do I need to specify anything else in the .plist file? I installed nom using homebrew.
I figured it out minutes after posting my comment :-)
I needed to add the following to my .plist file:
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>$PATH:/usr/local/bin</string>
</dict>
Hope this helps others
Thanks @WizBangCrash,
but where (in file) did you set your instruction?
I set this in org.nodered.plist this:
<key>PATH</key> <string>$PATH:/usr/local/bin</string>
But Pallete still not working...
Here is the correct .plist script with palette working:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd >
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.nodered.plist</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/node</string>
<string>/usr/local/bin/node-red</string>
<string>-v</string>
</array>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>$PATH:/usr/local/bin</string>
</dict>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardOutPath</key>
<string>/Users/YOURUSER/.node-red/node-red.log</string>
<key>WorkingDirectory</key>
<string>/Users/YOURUSER/.node-red</string>
</dict>
</plist>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The first comment says the script should go into "/Users/YOURUSER/LaunchAgents" but it appears it should really go into "/Users/YOURUSER/Library/LaunchAgents" instead?