Installing Node-RED on macOS or Windows, auto startup with PM2

macos node-red installation chrome
Share on facebook
Share on twitter
Share on linkedin
Share on pinterest
Share on email
Share on whatsapp
drapeau france
level beginner

Node-RED can be used on all platforms that can run Node.js. In this tutorial, we’ll see how to install Node-RED on macOS or a Windows PC under Windows 10. There are several installation methods. To write this tutorial, I have remained faithful to the official installation methods. The Mac installation was done on macOS El Captain (10.11.6). Installation on a higher version should not be any different.

Install node.js for macOS or Windows

Node-RED supports node.js 0.10.x or later. It is recommended to use the LTS (long-term maintenance) version of node.js

Get and install node.js 4.x LTS that matches your platform

macos node-red installation node.js autre plateformes

Run the executable to start the installation.

macos node-red installation node.js

The operation is very fast. The installation program will ask you the destination directories at the end of the operation.

macos node-red installation node.js repertoires

Install Node-RED on macOS

On macOS, the installation of Node-RED is identical to Linux (or Raspian). You must precede the npm command of a sudo. The -g means that the sources will be uploaded to the npm directory and will be available for all node.js. –unsafe-perm allows to continue the installation in the event of an error.

sudo npm install -g --unsafe-perm node-red

Installation is completed

macos node-red npm install -g --unsafe-perm

You just have to start with the node-red command. At first boot, the necessary directories and files will be created automatically

File / folderLocalisation
User Directory/Users/<user>/.node-red
Settings File/Users/<user>/.node-red/settings.js
Flows File/Users/<user>/.node-red/flows_<hostname>.json
ExecutableLien symbolique /usr/local/bin/node-red vers /usr/local/lib/node_modules/node-red/red.js

The dot (.) In front of the directory means that it is invisible. To make it visible in the finder, open a Terminal and run the following command

defaults write AppleShowAllFiles YES

Note. Run the command again with N instead of YES to hide folders and files again.

Then restart the Finder with the command

killall Finder

Enter the ip address of the specified server. By default it will be

macos node-red demarrage

It’s up to you to play!

macos node-red installation chrome

Start Node-RED on startup with PM2

There are several ways to start NR automatically on Mac (or Windows). Here I suggest you use PM2, a process manager for Node.js. The advantage is that this solution works on all platforms. Convenient, if you ever have the urge to develop on Raspberry Pi.

sudo npm install -g pm2

If you no longer know the Node-RED path, run this command

which node-red

On macOS, it should be in /usr/local/bin/node-red .

To run NodeRED, run this command PM2

pm2 start /usr/local/bin/node-red -- -v

The configuration is saved and automatic start is activated

pm2 save
pm2 startup

Installing Node-RED on Windows 10

There is no Terminal on Windows, but there is PowerShell that recognizes most basic Linux commands. From Cortana, enter the first Power letters to find and launch PowerShell.

1 launch windows powershell

Check that npm and Nodejs are properly installed. Run npm -v then node -v as on a Linux system. Everything is well installed, you can continue.

2 versions node npm

With PowerShell, we will install Node-RED as on macOS or Linux. The sudo command should not be added.

npm install -g --unsafe-perm node-red

On Windows 10, the files are installed in the directory.


Whatever your version of Windows (current or future), the installation path is indicated by npm in the installation summary (at the end of the installation).

Start Node-Red manually

To manually start NR, go to the installation directory

cd C:\Users\<username>\AppData\Roaming\npm\node_modules\node-red

Then execute the command command

node red.js

On first startup, you will need to add a new rule to the Windows Firewall.

4 autoriser pare feu node red

So, everything works as on other platforms.

3 node red demarre

Start Node-RED automatically when Windows starts with PM2

There are several ways to start NR automatically on Windows. Here I suggest you use PM2, a process manager for Node.js. The advantage is that this solution works on all platforms. Practice, if you ever want to develop on Raspberry Pi. From PowerShell, run this command to install PM2.

npm install -g pm2

To manually start NodeRED, run this command by adapting the path to the red.js file. Change username by your name before to execute to command.

pm2 start C:\Users\<username>\AppData\Roaming\npm\node_modules\node-red\red.js -- -v

At startup, PM2 indicates the name of the application and its IDentifier and its name. Here 0 and red.

 pm2 start node-red windows

NodeRED now works in the background. Here are some useful commands. You can specify the ID or the name of the application. This is the name of the application launched by PM2 (here red).

  • pm2 restart ID | NAME: restart NR.
  • pm2 stop ID | NAME: stop NodeRED
  • pm2 log ID | NAME: displays the real-time execution log of the indicated program. This is very useful for tracking the execution of NodeRED.
  • pm2 status ID | NAME
  • pm2 info ID | NAME: displays a lot of useful info (status, paths, versions …)

pm2 info node-red windows10

Now we will add the necessary packages to allow PM2 to launch automatically. run

npm install pm2-windows-startup -g 
pm2-startup install

All you have to do is save the configuration

pm2 save

At the next start, PM2 will automatically launch Node-RED at logon! After logging on, open PowerShell and run the pm2 status command to verify.

 pm2 startup status windows 10 node-red nodered

To learn more about Node-RED, see the dedicated category.


Click to rate this post!
[Total: 0 Average: 0]

Are you having a problem with this topic?

Maybe someone has already found the solution, visit the forum before asking your question
Ask your question

Share on facebook
Share on twitter
Share on linkedin
Share on pinterest
Share on email
Share on whatsapp

Did you like this project ? Don't miss any more projects by subscribing to our weekly newsletter!

  1. now thats a stupid tutorial, it should be about how to install on macOS or Windows and just when the important stuff should happen you only explain macOS and Linux leaving the whole windows explanation to as little as “how to download th software”

    • Hello Thomas . You are right, this article can not be anything now. But you’re a little rough with me! First of all, do not forget that Node-red remains a very recent open source project that evolves constantly and very quickly. The installation methods evolve … So I have to constantly update the articles or write new ones. I do all that work on my spare time. I hope with all my heart that you love the rest of the site and that you have found my other articles more useful. See you soon. Christophe

      • i may have gotten a little carried away here out of frustration of not finding anything about the windows installation that goes beyond download this file and install as this is not the whole story to tell.
        For some reason everyone is always only mentioning Linux which is already explained in detail but there is nothing on how to do it under windows or any kind of troubleshooting under windows.

    Leave a Reply

    DIY Projects
    %d bloggers like this: