Instantly share code, notes, and snippets.

What would you like to do?
Node-Red launchd script
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN >
<plist version="1.0">

This comment has been minimized.


natcl commented Feb 28, 2015

This is a Launchd script for Node-Red so that it launches on stratup and restarts if it crashes.
This script assumes you have installed Node-Red using the command sudo npm install -g node-red
Make sure to change /Users/YOURUSER to your own user's home directory path.

You will need to place this script in /Users/YOURUSER/LaunchAgents and then run launchctl load -w org.nodered.plist from that directory.

To stop the daemon you can run launchctl unload org.nodered.plist


This comment has been minimized.


natcl commented Mar 1, 2015

Here's an alias you can add to your .bashrc or .bash_profile file to quickly restart node-red:

alias restartnode="launchctl unload ~/Library/LaunchAgents/org.node-red.plist ; launchctl load -w ~/Library/LaunchAgents/org.node-red.plist"

This comment has been minimized.

akobelan commented Sep 7, 2015

Nice work. There is an inconsistency in the naming of your plist file. Either name the plist file org.node-red.plist or org.nodered.plist. The alias you provide will not work otherwise. Newcomers will likely not figure this out.

Thanks for helping out the "other" platform.


This comment has been minimized.

bkeating commented Sep 8, 2015

Thanks, @natcl. Very useful. Saved me time.


This comment has been minimized.

cyberreefguru commented Jan 18, 2016

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?


This comment has been minimized.

WizBangCrash commented Feb 4, 2018

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:


Hope this helps others


This comment has been minimized.

JJiri commented Jun 14, 2018

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment