π§ n8n Local Setup & Activation Guide (Node + PM2 on macOS)
This note explains how to start, stop, and manage n8n on your local machine after installing it with Node.js.
Use this anytime you need to activate or deactivate n8n for automation projects.
π§© 1. Installation Check
After installing n8n globally:
npm install -g n8n
Confirm installation:
n8n -v
If you see a version number (e.g. 1.55.2), itβs correctly installed.
βοΈ 2. Basic Manual Run (Foreground Mode)
Use this when you just want to run n8n temporarily.
Start n8n
n8n start
or simply:
n8n
Access Interface
Open in your browser:
π http://localhost:5678
On the first run, youβll create your owner account.
Stop n8n
Press:
Ctrl + C
in the same terminal window.
Note
If you see:
n8n's port 5678 is already in use
it means another n8n process is already running (see Section 5).
π₯οΈ 3. Running n8n in Background with PM2
PM2 lets n8n run even when you close your terminal or log out.
Install PM2
npm install -g pm2
Start n8n in background
pm2 start n8n --name n8n
Check if itβs running
pm2 list
If you see n8n with status online, itβs active.
Open the dashboard
Visit:
π http://localhost:5678
View logs (optional)
pm2 logs n8n
π οΈ 4. Managing n8n with PM2
Action | Command | Description |
Start (activate) n8n | pm2 start n8n | Starts background process |
Stop (deactivate) n8n | pm2 stop n8n | Stops n8n without deleting it |
Restart n8n | pm2 restart n8n | Restarts quickly |
Delete n8n process | pm2 delete n8n | Removes from PM2 list |
Check status | pm2 list | Shows all PM2-managed processes |
View logs | pm2 logs n8n | Displays activity logs |
Detailed info | pm2 describe n8n | Process details |
π 5. Fix: Port Already in Use
If you see:
n8n's port 5678 is already in use
That means an n8n instance is already active.
Option A β Stop running process via PM2
pm2 stop n8n
Option B β Kill process manually
Find whatβs using the port:
lsof -i :5678
Then kill it:
kill -9 <PID>
Replace <PID> with the process ID shown in the result.
Option C β Start on another port
n8n start --port 5679
Then access at:
π http://localhost:5679
π 6. Optional: Secure Access
Create an .env file in your n8n folder (e.g. ~/.n8n/.env):
N8N_HOST=localhost
N8N_PORT=5678
N8N_PROTOCOL=http
# Basic Auth
N8N_BASIC_AUTH_ACTIVE=true
N8N_BASIC_AUTH_USER=teslim
N8N_BASIC_AUTH_PASSWORD=choose-a-strong-password
Export and start:
export $(grep -v '^#' ~/.n8n/.env | xargs)
pm2 start n8n --name n8n
Now your n8n UI will prompt for a username and password.
β‘ 7. Auto-Start n8n on Mac Boot
Make n8n start automatically whenever you log in.
- Generate startup command:
- Save current processes:
- From now on, PM2 (and n8n) will automatically start at login.
pm2 startup launchd
PM2 will output a line like:
sudo env PATH=$PATH:/usr/local/bin pm2 startup launchd -u yourusername
Copy and run that line.
pm2 save
π§ 8. Useful Commands Summary
Purpose | Command |
Check if n8n is running | pm2 list |
Activate n8n | pm2 start n8n |
Deactivate n8n | pm2 stop n8n |
Restart | pm2 restart n8n |
Delete process completely | pm2 delete n8n |
View logs | pm2 logs n8n |
Reload all saved processes after reboot | pm2 resurrect |
Save current process list | pm2 save |
π 9. Access Point
Once running, open your browser to:
n8n Dashboard:
π http://localhost:5678
Use this address anytime you want to open the editor interface.
πͺ 10. Quick Workflow Activation Guide
Inside the n8n dashboard:
- Activate a workflow:
- Deactivate a workflow:
Toggle the Active switch (top-right corner).
This enables triggers like Webhook, Cron, or Schedule.
Toggle Active back to Off to pause triggers.
β Summary Overview
Step | Description | Key Command |
1 | Install n8n | npm install -g n8n |
2 | Install PM2 | npm install -g pm2 |
3 | Start n8n (temp) | n8n start |
4 | Start n8n (permanent) | pm2 start n8n --name n8n |
5 | Access UI | http://localhost:5678 |
6 | Stop n8n | pm2 stop n8n |
7 | Auto-start setup | pm2 startup launchd && pm2 save |
π Notes
- Port
5678is the default; if busy, use another port with-port. - Logs and settings are stored under:
- Keep your
.envfile secure with:
~/.n8n/
chmod 600 ~/.n8n/config