# How to Install n8n on macOS

- Tool: n8n
- Difficulty: Beginner
- Time required: 10 minutes
- Compatibility: macOS 12 Monterey or newer, Homebrew or Node.js 18+
- Last updated: March 2026

## TL;DR

Install n8n on macOS using Homebrew with brew install n8n, or using npm with npm install n8n -g after installing Node.js 18 or newer. Start n8n with n8n start and open http://localhost:5678 in your browser. Homebrew is the easiest method as it handles Node.js dependencies automatically.

## Installing n8n on macOS

n8n can be installed on macOS in two ways: Homebrew (the easiest) or npm (more control). Homebrew installs n8n as a formula and manages the Node.js dependency for you. The npm method requires you to install Node.js first, then install n8n as a global package. Both methods give you the full n8n editor and all community nodes. This tutorial walks through both approaches, plus how to keep n8n running in the background using launchd or Docker.

## Before you start

- macOS 12 Monterey or newer
- Terminal access (Applications > Utilities > Terminal, or iTerm2)
- Homebrew installed (for the Homebrew method) — install from brew.sh
- A web browser (Safari, Chrome, Firefox)

## Step-by-step guide

### 1. Install n8n with Homebrew (recommended)

Homebrew is the simplest way to install n8n on macOS. If you do not have Homebrew installed, visit brew.sh and follow the one-line install command. Once Homebrew is ready, run brew install n8n to install n8n and its dependencies. Homebrew handles the Node.js requirement automatically. After installation, the n8n command is available in your terminal.

```
# Install Homebrew (if not already installed)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# Install n8n
brew install n8n

# Verify installation
n8n --version
```

**Expected result:** n8n is installed via Homebrew. Running n8n --version shows the installed version number.

### 2. Alternative: Install with npm

If you prefer more control over the Node.js version or already have Node.js installed, use npm. First, install Node.js 18 or newer — either from nodejs.org or via Homebrew with brew install node. Then install n8n globally with npm. The -g flag makes the n8n command available system-wide.

```
# Install Node.js via Homebrew (if needed)
brew install node

# Verify Node.js version (must be 18+)
node --version

# Install n8n globally
npm install n8n -g

# Verify installation
n8n --version
```

**Expected result:** Node.js and n8n are installed. Both node --version and n8n --version return version numbers.

### 3. Start n8n and create your account

Run n8n start in your terminal. n8n starts a web server on port 5678. Open http://localhost:5678 in your browser. On the first run, n8n presents a setup screen where you create an owner account with your name, email, and password. After setup, you land in the n8n editor where you can create workflows. The terminal must stay open while n8n is running.

```
# Start n8n
n8n start

# Output:
# n8n ready on 0.0.0.0, port 5678
# Editor is now accessible via http://localhost:5678
```

**Expected result:** n8n is running and accessible at http://localhost:5678. The browser shows the setup screen on first visit.

### 4. Run n8n in the background

To keep n8n running without keeping a terminal window open, use one of these approaches. For quick background execution, use nohup or the Homebrew services command. For a persistent service that starts on login, create a launchd plist. Docker is another option that keeps n8n isolated from your system.

```
# Option 1: Homebrew services (if installed via brew)
brew services start n8n

# Option 2: nohup (quick background execution)
nohup n8n start &

# Option 3: Docker
docker run -d \
  --name n8n \
  -p 5678:5678 \
  -v n8n_data:/home/node/.n8n \
  docker.n8n.io/n8nio/n8n

# To stop:
brew services stop n8n   # Option 1
kill $(pgrep -f 'n8n start')  # Option 2
docker stop n8n          # Option 3
```

**Expected result:** n8n runs in the background. You can close the terminal and n8n continues running. Access it at http://localhost:5678.

### 5. Update n8n

Keep n8n updated to get the latest features, bug fixes, and new nodes. The update command depends on your installation method. After updating, restart n8n to apply the changes. Back up your workflows before updating — export them via the UI or CLI as a precaution.

```
# Update via Homebrew
brew upgrade n8n

# Update via npm
npm update n8n -g

# Update Docker
docker pull docker.n8n.io/n8nio/n8n
docker stop n8n
docker rm n8n
docker run -d \
  --name n8n \
  -p 5678:5678 \
  -v n8n_data:/home/node/.n8n \
  docker.n8n.io/n8nio/n8n
```

**Expected result:** n8n is updated to the latest version. Run n8n --version to confirm. Restart n8n to use the new version.

## Complete code example

File: `setup-n8n-macos.sh`

```bash
#!/bin/bash
# setup-n8n-macos.sh
# Install and configure n8n on macOS

set -euo pipefail

echo "=========================================="
echo " n8n Installation Script for macOS"
echo "=========================================="
echo ""

# Check if Homebrew is installed
if command -v brew &> /dev/null; then
  echo "Homebrew found: $(brew --version | head -1)"
else
  echo "Installing Homebrew..."
  /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi

# Check if n8n is already installed
if command -v n8n &> /dev/null; then
  echo "n8n is already installed: $(n8n --version)"
  echo "Updating to the latest version..."
  brew upgrade n8n 2>/dev/null || npm update n8n -g
else
  echo "Installing n8n via Homebrew..."
  brew install n8n
fi

echo ""
echo "n8n version: $(n8n --version)"
echo ""

# Ask user how to run n8n
echo "How would you like to run n8n?"
echo "  1) Foreground (terminal stays open)"
echo "  2) Background service (starts on login)"
echo "  3) Just install, I will start it later"
echo ""
read -p "Choose [1/2/3]: " choice

case $choice in
  1)
    echo "Starting n8n in foreground..."
    echo "Open http://localhost:5678 in your browser"
    echo "Press Ctrl+C to stop"
    n8n start
    ;;
  2)
    echo "Starting n8n as a background service..."
    brew services start n8n
    echo "n8n is running in the background"
    echo "Open http://localhost:5678 in your browser"
    echo "To stop: brew services stop n8n"
    ;;
  3)
    echo "Installation complete!"
    echo "To start n8n, run: n8n start"
    echo "Then open http://localhost:5678"
    ;;
  *)
    echo "Installation complete!"
    echo "To start n8n, run: n8n start"
    ;;
esac
```

## Common mistakes

- **Using a Node.js version older than 18** — undefined Fix: n8n requires Node.js 18 or newer. Run node --version to check. If it is older, update with brew upgrade node or install the latest LTS from nodejs.org.
- **Closing the terminal window and n8n stops running** — undefined Fix: Use brew services start n8n to run n8n as a background service that persists after closing the terminal and starts automatically on login.
- **Installing n8n with npm without the -g flag** — undefined Fix: Without -g, n8n is installed locally in the current directory only. Use npm install n8n -g to install globally so the n8n command works from anywhere.
- **Port 5678 is already in use by another application** — undefined Fix: Either stop the other application using port 5678, or start n8n on a different port: N8N_PORT=5679 n8n start.

## Best practices

- Use Homebrew for the simplest installation and updates — it handles dependencies automatically
- Run n8n as a background service with brew services start n8n for persistent operation
- Back up your workflows before updating n8n to a new version
- The .n8n directory at ~/.n8n contains your database and settings — include it in your backups
- Use Docker if you want to isolate n8n from your system Node.js installation
- If using nvm, pin a specific Node.js version for n8n to avoid compatibility issues after switching versions
- Check n8n's release notes before updating to understand breaking changes

## Frequently asked questions

### Is Homebrew or npm better for installing n8n on macOS?

Homebrew is easier because it handles the Node.js dependency automatically and provides simple service management with brew services. Use npm if you need a specific Node.js version or already manage Node.js with nvm.

### Where does n8n store its data on macOS?

n8n stores its SQLite database, credentials, and settings in the ~/.n8n directory (i.e., /Users/YourUsername/.n8n). Back up this directory regularly.

### How do I stop n8n on macOS?

If running in the foreground, press Ctrl+C. If running as a Homebrew service, use brew services stop n8n. If running in Docker, use docker stop n8n.

### Can I run n8n on an M1/M2/M3 Mac (Apple Silicon)?

Yes. n8n runs natively on Apple Silicon Macs. Both the Homebrew and npm installation methods work on ARM-based Macs without any special configuration.

### How do I change the port n8n runs on?

Set the N8N_PORT environment variable before starting n8n. For example: N8N_PORT=5679 n8n start. This starts n8n on port 5679 instead of the default 5678.

### Can RapidDev help set up n8n for production use on macOS or a cloud server?

Yes. RapidDev can install, configure, and maintain production n8n deployments on macOS, Linux, or cloud infrastructure. Contact RapidDev for a free consultation.

---

Source: https://www.rapidevelopers.com/n8n-tutorial/how-to-install-n8n-on-macos
© RapidDev — https://www.rapidevelopers.com/n8n-tutorial/how-to-install-n8n-on-macos
