Running n8n locally is one of the easiest and most flexible ways to get started with workflow automation on your own terms. Whether you’re using Mac, Windows, or Linux, setting up n8n on your local machine lets you explore all its features without paying a dime, deploying to a server, or dealing with cloud hosting limitations. In this guide, you’ll learn how to run n8n locally step by step on any major operating system using Node.js or Docker.
Why Run n8n Locally?
Running n8n on your local machine allows for full workflow control, data privacy, and easy debugging. This is perfect for beginners testing automations, developers building integrations, or small teams managing in-house processes.
Key benefits of running n8n locally:
- No hosting costs or deployment steps
- Total data control (nothing leaves your machine)
- Faster prototyping and debugging environment
- Offline capability in some use cases
Let’s now dive into how you can run n8n locally on your system.
Requirements for Running n8n Locally
Before installing, make sure your system has the following:
- Node.js (v18 or newer) OR Docker Desktop
- npm (Node Package Manager) if using Node.js
- Terminal/Command Prompt access
Option 1: Run n8n Locally Using Node.js
This approach is ideal if you want full transparency, and you’re comfortable running CLI commands.
Step 1: Install Node.js and npm
Download the latest Node.js from nodejs.org. It includes npm by default.
To verify installation:
node -v
npm -v
Step 2: Install n8n via npm
Once Node.js is set up, open your terminal and run:
npm install n8n -g
This installs n8n globally so you can run it from anywhere.
Step 3: Start n8n
Simply enter:
n8n
After a few seconds, n8n will be available at http://localhost:5678. You now have a fully functioning local automation engine.
Tip: Don’t close the terminal window or n8n will stop running. Use additional tools like PM2 or Docker if you need a background service.
Option 2: Run n8n Locally Using Docker
If you prefer isolation or need something closer to a production-like environment, Docker is a great choice.
Step 1: Install Docker
Head over to the Docker website to install Docker Desktop for your OS. Verify the installation with:
docker --version
Step 2: Start n8n Container
Run the following command to spin up a basic local n8n container:
docker run -it --rm \
-p 5678:5678 \
-v ~/.n8n:/home/node/.n8n \
n8nio/n8n
This:
- Binds port 5678 to your localhost
- Mounts your workflows in a local
.n8nfolder for persistence - Starts n8n interactively
Now just open http://localhost:5678 to access your local n8n editor.
You can also use Docker Compose if you prefer more declarative setups.
OS-Specific Setup Tips
Running n8n Locally on Mac
- Use Homebrew to install Node.js quickly:
brew install node .n8nfolder is usually in your/Users/yournamedirectory- Consider installing with Docker on Mac for containerized control
Running n8n Locally on Windows
- Make sure to run Command Prompt or PowerShell as admin
- Use Node.js LTS installer for stable setup
- Paths might differ;
.n8nis inC:\Users\YourUser\.n8n - If Docker is slow, WSL2 performance tweaks might help
Full walkthrough: Installing n8n on Windows
Running n8n Locally on Linux
- Node.js can be installed with
apt,dnf, orsnap, depending on your distro - Docker works cleanly across distros like Ubuntu, Debian, Fedora
- You may want to create a systemd service if you plan long-term local hosting
Check out this related guide: How to Install n8n on Linux
Saving and Exporting Workflows
When running n8n locally, your workflows and credentials are stored in a local .n8n directory. To avoid data loss or to share workflows:
To Export a workflow:
- Click the “Download” icon on your workflow canvas
- Choose “Download Workflow JSON”
You can also download and export workflows manually as part of a versioning or deployment workflow.
Visual Summary of Setup Options
Here’s a quick table comparing different ways to run n8n locally:
| Method | Pros | Ideal For |
|---|---|---|
| Node.js | Fast setup, no containers | Beginners, scripting workflows |
| Docker | Isolated, replicable environments | Developers, power users |
| Docker Compose | Scalable, easy to maintain config | Persistent local projects |
Sample Use Case: Local Email Automation
Want to test email workflows before pushing them live? Set up a local SMTP test server (like MailHog) and connect it to your local n8n instance. This way, you can automate alerts, digest emails, or CRON-based reminders with zero risk.
Pair with the email automation agent guide to build a full local prototype before production.
Pro Tip: Use Environment Variables
You can add .env files or CLI arguments to customize your local n8n experience:
export N8N_BASIC_AUTH_USER=admin
export N8N_BASIC_AUTH_PASSWORD=securepass
n8n
This adds password protection to your local editor.
Troubleshooting Local n8n Issues
If n8n won’t start or crashes:
- Ensure no other service is using port 5678
- Check logs for missing dependencies or permission errors
- Reinstall Node or n8n if modules break
You can also look through the top n8n issues and troubleshooting guide for help with specific errors.
FAQ
Can I use n8n without installing anything?
Yes, you can use n8n.cloud or platforms like Replit for cloud-based automation. But for local use, you’ll need at least Node.js or Docker.
Does running n8n locally cost anything?
No. Running n8n locally is 100% free and open-source. You only need your own device.
Will changes persist when I restart n8n?
If you’re using Docker, make sure to mount the .n8n folder using the -v option. With the Node.js install, changes are saved in your user’s profile directory.
How can I build advanced workflows locally?
You can install community nodes or use AI integrations to enhance workflows. Learn how to install custom nodes from templates quickly and easily.
Is running n8n locally secure?
Yes, if it’s just for internal use. But if you expose it to the internet, use HTTPS and enable authentication to protect your workflows.
Running n8n locally is the perfect way to learn, test, and scale your automations while keeping full control. Whether you’re building simple integrations or complex agent workflows, local development gives you freedom without cost or limits.