---
title: "Upgrading Node.js to 22 on macOS Sequoia"
slug: "upgrade-node-22-macos-sequoia"
published: "2025-10-04"
updated: "2025-10-07"
validated: "2025-10-20"
categories:
  - "Next.js"
tags:
  - "Node.js 22"
  - "macOS Sequoia"
  - "Homebrew"
  - "keg-only"
  - "zsh PATH"
  - "Next.js runtime"
  - "brew link"
  - "Vercel runtime"
llm-intent: "reference"
audience-level: "beginner"
framework-versions:
  - "node@22"
  - "next.js@15"
status: "stable"
llm-purpose: "Guide to upgrade Node.js to 22 on macOS Sequoia using Homebrew. Link the keg, update PATH, and verify the runtime for Next.js builds that require Node 22"
llm-prereqs:
  - "Access to Homebrew"
  - "Access to zsh"
  - "Access to Node.js"
llm-outputs:
  - "Completed outcome: Guide to upgrade Node.js to 22 on macOS Sequoia using Homebrew. Link the keg, update PATH, and verify the runtime for Next.js builds that require Node 22"
---

**Summary Triples**
- (Check current Node runtime, command, Run `node -v` (and `which -a node`) to confirm if shell resolves legacy /usr/local/bin/node (e.g., v19.3.0).)
- (Install Node 22, command, Run `brew install node@22` to install the keg-only Node 22 formula into Homebrew's cellar.)
- (Keg-only behavior, explanation, Homebrew leaves node@22 keg-only, so installing does not automatically override an existing /usr/local/bin/node.)
- (Force symlink, command, Run `brew link --force --overwrite node@22` to symlink node@22 into the Homebrew prefix (e.g., /opt/homebrew/bin).)
- (Persist PATH for zsh, action, Add `/opt/homebrew/bin` to the front of PATH in `~/.zshrc` (echo line and source) so zsh resolves the Homebrew node before legacy binaries.)
- (Verify change, command, After linking and updating PATH, run `node -v` and `which node` to confirm the binary is v22 from Homebrew.)
- (Vercel parity, note, Vercel's default Node runtime exposes major 22.x (and 20.x); upgrading locally to Node 22 keeps parity with deployments.)

### {GOAL}
Guide to upgrade Node.js to 22 on macOS Sequoia using Homebrew. Link the keg, update PATH, and verify the runtime for Next.js builds that require Node 22

### {PREREQS}
- Access to Homebrew
- Access to zsh
- Access to Node.js

### {STEPS}
1. Follow the detailed walkthrough in the article content below.

<!-- llm:goal="Guide to upgrade Node.js to 22 on macOS Sequoia using Homebrew. Link the keg, update PATH, and verify the runtime for Next.js builds that require Node 22" -->
<!-- llm:prereq="Access to Homebrew" -->
<!-- llm:prereq="Access to zsh" -->
<!-- llm:prereq="Access to Node.js" -->
<!-- llm:output="Completed outcome: Guide to upgrade Node.js to 22 on macOS Sequoia using Homebrew. Link the keg, update PATH, and verify the runtime for Next.js builds that require Node 22" -->

# Upgrading Node.js to 22 on macOS Sequoia
> Guide to upgrade Node.js to 22 on macOS Sequoia using Homebrew. Link the keg, update PATH, and verify the runtime for Next.js builds that require Node 22
Matija Žiberna · 2025-10-04

I was building a Next.js 15 project on my MacBook when the production build died with a warning: Node 19.3.0 no longer meets the runtime floor. After a bit of digging—and a reminder that macOS Sequoia ships with an older `/usr/local/bin/node`—I landed on a clean upgrade path. This guide walks you through upgrading to Node 22 with Homebrew and making sure zsh always picks it first, which also keeps your local runtime aligned with Vercel’s current defaults.

## Confirm the runtime Next.js is using
The first thing I did was double-check the version Next.js pulled at build time. If your shell still resolves the legacy binary, the build will fail long before you reach the fix.

```bash
# Terminal
node -v
```

If the command echoes `v19.3.0`, your session is hitting the historic `/usr/local/bin/node` that ships with older Homebrew installs. Keep that value in mind—we’ll use it as the baseline the next time we verify the PATH.

## Install Node 22 from Homebrew
Homebrew hosts a keg-only `node@22` formula that plays nicely alongside any older runtimes. Installing it on macOS Sequoia pulls in the updated TLS certificates and HTTP/3 dependencies that Node 22 expects by default. Vercel’s runtime matrix only exposes major versions 22.x (default) and 20.x, rolling minor updates automatically, so upgrading locally keeps parity with what your serverless functions will run in production. See the [Vercel Node.js runtime documentation](https://vercel.com/docs/functions/runtimes/node-js/node-js-versions) for the full support table.

```bash
# Terminal
brew install node@22
```

Homebrew stages the binary under `/opt/homebrew/Cellar/node@22/22.x.y` and leaves it keg-only, which means it does not automatically take precedence over the legacy executable. The next step fixes that.

## Force macOS Sequoia to prefer the new keg
Because the legacy binary still lives in `/usr/local/bin`, I needed to point the system-wide symlink at the fresh Node 22 keg. Using the `--overwrite` and `--force` flags ensures the old symlink does not linger.

```bash
# Terminal
brew link --overwrite --force node@22
```

With the symlink in place, `/opt/homebrew/bin/node` resolves to Node 22. However, many Sequoia setups still put `/usr/local/bin` ahead of Homebrew in the PATH, so the next step hard-pins the newer binary for every zsh login.

## Persist Node 22 in zsh
To keep the environment consistent, I added the Homebrew keg’s bin directory to my `~/.zshrc`. This guarantees that any future terminal—including those spawned by IDEs—prefers Node 22 before it finds the older fallback.

```zsh
# File: ~/.zshrc
export PATH="/opt/homebrew/opt/node@22/bin:$PATH"
```

Place this line near your other PATH exports so the order stays predictable. When zsh re-evaluates the file, it prepends the Node 22 keg directory, locking in the upgrade for every session.

## Reload your shell and check Next.js
Finally, reload the shell so the updated PATH takes effect and confirm the runtime before re-running the Next.js build.

```bash
# Terminal
zsh -lic 'node -v'
```

This command launches a fresh login shell, sources `~/.zshrc`, and prints the Node version that Next.js will see. Once it returns `v22.20.0` (or a newer 22.x release), you can confidently re-run `pnpm run build` without tripping the runtime warning.

Upgrading the runtime fixed the build blockers immediately: Next.js relied on modern Web Streams support that only ships in Node 19.8.0 and above, and Node 22 brings those APIs plus better performance across the board. It also means local builds now match Vercel’s default 22.x environment, avoiding discrepancies between development and deployment.

By upgrading Homebrew’s Node keg, forcing the symlink, and persisting the PATH update in zsh, you ensured macOS Sequoia pulls the right binary every time. You can now compile your Next.js app with Node 22 without fighting legacy tooling. Let me know in the comments if you have questions, and subscribe for more practical development guides.

Thanks, Matija

## LLM Response Snippet
```json
{
  "goal": "Guide to upgrade Node.js to 22 on macOS Sequoia using Homebrew. Link the keg, update PATH, and verify the runtime for Next.js builds that require Node 22",
  "responses": [
    {
      "question": "What does the article \"Upgrading Node.js to 22 on macOS Sequoia\" cover?",
      "answer": "Guide to upgrade Node.js to 22 on macOS Sequoia using Homebrew. Link the keg, update PATH, and verify the runtime for Next.js builds that require Node 22"
    }
  ]
}
```