Learn how to install n8n on macOS with step-by-step instructions, including Node.js setup, running n8n, Docker option, configuration, and troubleshooting tips.
Book a call with an Expert
Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.
n8n is a workflow automation platform that connects various services and APIs. To install n8n on macOS, you need to have Node.js installed and then use npm to install and run n8n. The installation process is straightforward and can be completed through Terminal commands.
Step 1: Check System Requirements
Before installing n8n, make sure your macOS system meets the minimum requirements:
Step 2: Install Node.js and npm
If you don't have Node.js installed already, you'll need to install it first. There are several ways to install Node.js on macOS:
Option 1: Install using Homebrew (recommended)
If you have Homebrew installed, you can use it to install Node.js:
brew update
brew install node
Option 2: Install using the official installer
Visit the Node.js website (https://nodejs.org) and download the LTS version for macOS. Run the installer and follow the instructions.
To verify that Node.js and npm are installed correctly, open Terminal and run:
node -v
npm -v
These commands should display the versions of Node.js and npm installed on your system.
Step 3: Install n8n Globally
You can install n8n globally on your system using npm:
npm install n8n -g
This command installs n8n globally, making the n8n
command available from anywhere in your terminal.
If you encounter permission errors, you might need to use sudo:
sudo npm install n8n -g
Step 4: Start n8n
After installation, you can start n8n by running:
n8n
This will start n8n with default settings. The first time you run n8n, it will create a .n8n
folder in your home directory to store settings, workflows, and credentials.
Step 5: Access the n8n Editor
Once n8n starts, you can access the web editor by opening your browser and navigating to:
http://localhost:5678
You should now see the n8n editor interface where you can create and manage your workflows.
Step 6: Configure n8n (Optional)
You can configure n8n using environment variables or command-line arguments. Here are some common configurations:
Change the default port:
n8n start --port=8080
Enable basic authentication:
n8n start --basic-auth-active=true --basic-auth-user=USER --basic-auth-password=PASSWORD
Run n8n with a different database (default is SQLite):
n8n start --database-type=postgresdb --database-postgresdb-host=localhost --database-postgresdb-database=n8n --database-postgresdb-user=postgres --database-postgresdb-password=password
Step 7: Run n8n as a Background Service
To run n8n as a background service on macOS, you can use pm2, a process manager for Node.js applications:
npm install pm2 -g
pm2 start n8n
To make n8n start automatically on system boot:
pm2 startup
pm2 save
Follow any instructions provided by the pm2 startup command.
Step 8: Update n8n When Needed
To update n8n to the latest version when updates are available:
npm update -g n8n
If you're using pm2, restart n8n after updating:
pm2 restart n8n
Step 9: Install n8n Using Docker (Alternative Method)
If you prefer using Docker, you can install n8n using Docker on macOS:
First, install Docker Desktop for Mac from the Docker website.
Once Docker is installed and running, execute:
docker run -it --rm \\
--name n8n \\
-p 5678:5678 \\
-v ~/.n8n:/home/node/.n8n \\
n8nio/n8n
This command pulls the n8n image and runs it, mapping port 5678 and creating a volume for persistent data storage.
Step 10: Troubleshooting Common Issues
Issue: Port conflicts
If another application is using port 5678, you'll get an error. Change the port using:
n8n start --port=8080
Issue: Permission errors during installation
If you encounter permission errors when installing globally, try:
npm install n8n -g --unsafe-perm
Issue: Node.js version conflicts
If you have multiple Node.js versions, you can use nvm (Node Version Manager) to switch to a compatible version:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
nvm install 18
nvm use 18
npm install n8n -g
Issue: Database connection issues
By default, n8n uses SQLite. If you configured a different database and have connection issues, verify your database connection parameters.
Step 11: Advanced Configuration
Using environment variables
You can create a .env
file in your n8n directory to store environment variables:
N8N\_PORT=5678
N8N\_PROTOCOL=http
N8N\_HOST=localhost
N8N\_PATH=/
N8N_BASIC_AUTH\_ACTIVE=true
N8N_BASIC_AUTH\_USER=user
N8N_BASIC_AUTH\_PASSWORD=password
Setting up a secure HTTPS connection
To use HTTPS:
n8n start --protocol=https --ssl-key=/path/to/key.pem --ssl-cert=/path/to/cert.pem
Step 12: Backing Up Your n8n Data
n8n stores its data in the ~/.n8n
directory by default. To back up your data:
mkdir -p ~/n8n-backup
cp -r ~/.n8n ~/n8n-backup/n8n-backup-$(date +%Y%m%d)
For workflow exports, you can use the n8n CLI:
n8n export:workflow --all --output=~/n8n-backup/workflows.json
Step 13: Setting Up n8n with Tunneling for Remote Access
If you want to access your local n8n instance remotely or share it with others, you can use a tunneling service like ngrok:
brew install ngrok
ngrok http 5678
Ngrok will provide a public URL that forwards to your local n8n instance.
Step 14: Customizing n8n with Extensions
n8n allows you to create custom nodes and credentials. To set up a development environment:
mkdir n8n-custom-nodes
cd n8n-custom-nodes
npm init -y
npm install n8n-core n8n-workflow --save
Then follow the n8n documentation for creating custom nodes.
Step 15: Resources for Further Learning
Once you have n8n installed, you might want to explore:
These resources will help you get the most out of your n8n installation and build powerful automation workflows.
When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.