# How to Brew Install Specific Version of Node: Complete Guide

> Easily brew install a specific Node.js version using brew install node@<major_version> and link it to your default command. Get the exact Node.js version you need for your projects.

- Repository: [Node.js/node](https://github.com/nodejs/node)
- Tags: how-to-guide
- Published: 2026-02-13

---

**Run `brew install node@<major_version>` to install a specific Node.js release line, then use `brew link --force --overwrite node@<version>` to activate it as your default `node` command.**

Homebrew provides versioned formulae that map directly to the official Node.js releases maintained in the nodejs/node repository. While the default `node` formula tracks the latest stable release, production environments often require older LTS versions that align with the version constants defined in the Node.js source code.

## Understanding Homebrew Versioned Formulae

Homebrew manages specific Node.js versions through dedicated formulae like `node@14`, `node@16`, and `node@18`. These versioned formulae correspond to the release lines tracked in the nodejs/node repository, where canonical version strings are defined in [`src/node_version.h`](https://github.com/nodejs/node/blob/main/src/node_version.h). This header file declares constants including `NODE_MAJOR_VERSION`, `NODE_MINOR_VERSION`, and `NODE_PATCH_VERSION`, ensuring that Homebrew-compiled binaries match the exact runtime version exposed via `process.version`.

When you request a specific version, Homebrew resolves the formula name to the corresponding file in the Homebrew core tap (e.g., `Formula/node@14.rb`). The formula specifies the exact `url` and `sha256` checksum for the source tarball, pulling from the Node.js distribution site to ensure reproducible builds.

## Installing a Specific Node.js Version

To brew install specific version of node, identify the major version you need (e.g., 14.x, 16.x, or 18.x LTS) and execute the corresponding command:

```bash
brew install node@14

```

This installs the latest patch release of the 14.x line (such as 14.21.3) to `/usr/local/opt/node@14/bin`. For precise patch versions when available, you may specify the full version number:

```bash
brew install node@18.16.0

```

Versioned installations are **keg-only**, meaning Homebrew does not automatically link them to `/usr/local/bin` to prevent conflicts with other Node.js installations. The binaries remain isolated in `/usr/local/opt/node@<version>/bin`.

Verify the installation by checking the binary directly:

```bash
/usr/local/opt/node@14/bin/node -v

```

Output:

```text
v14.21.3

```

## Linking and Switching Between Versions

Since Homebrew keeps versioned formulae unlinked by default, you must manually manage your `node` command path.

To make a specific version your default:

```bash
brew link --force --overwrite node@14

```

To switch from one version to another:

```bash
brew unlink node@14
brew link --force --overwrite node@16

```

If you need to use multiple versions simultaneously without switching, invoke the full path to the binary:

```bash
/usr/local/opt/node@18/bin/node -e "console.log(process.version)"

```

## How Homebrew Pins Node.js Versions

The version pinning mechanism relies on the Homebrew formula structure in the `homebrew-core` repository. Each `node@<version>.rb` file embeds the release numbers found in the Node.js [`src/node_version.h`](https://github.com/nodejs/node/blob/main/src/node_version.h) file, ensuring the built binary reports the correct version at runtime. Because the formulae are version-pinned with specific tarball URLs and checksums, you get reproducible builds that match the official Node.js releases.

For developers building Node.js from source, the repository's [`BUILDING.md`](https://github.com/nodejs/node/blob/main/BUILDING.md) file documents optional Homebrew dependencies such as `ccache` (`brew install ccache`) that can accelerate compilation.

## Summary

- Homebrew provides versioned formulae (`node@14`, `node@16`, etc.) to install specific Node.js major releases
- Versioned installations are stored in `/usr/local/opt/node@<version>/bin` and remain unlinked by default to prevent conflicts
- Use `brew link --force --overwrite node@<version>` to make a specific version the system default
- The Node.js [`src/node_version.h`](https://github.com/nodejs/node/blob/main/src/node_version.h) file defines the canonical version constants that Homebrew formulae reference
- Multiple versions can coexist; switch between them using `brew unlink` and `brew link` or invoke binaries directly via their full paths

## Frequently Asked Questions

### Can I install any patch version like 14.21.3 using Homebrew?

Homebrew typically maintains formulae for major version lines (e.g., `node@14`), which install the latest patch release available in that line. While specific patch versions like 14.21.3 may be available if the formula has not yet updated, or via `brew extract`, the standard approach installs the most recent patch of the specified major version. Check `brew info node@14` to see the exact version the formula currently provides.

### Why does `node -v` still show the old version after installing a new one?

This occurs because versioned Node.js formulae are keg-only and not automatically linked to your PATH. You must explicitly run `brew link --force --overwrite node@<version>` to update the `node` command, or adjust your shell configuration to prepend `/usr/local/opt/node@<version>/bin` to your PATH environment variable.

### How do I completely remove a specific Node.js version installed via Homebrew?

Use the `brew uninstall` command with the specific formula name: `brew uninstall node@14`. This removes the installation directory from `/usr/local/opt/node@14` without affecting other Node.js versions or the default `node` formula. You may also want to run `brew cleanup` to remove cached downloads.

### Can I use Homebrew to install Node.js versions not available as versioned formulae?

If a specific version is not available as a versioned formula (such as an odd-numbered development release), you can use `brew extract` to create a custom formula from an older version of the Homebrew core tap, or install the `node` formula and use `n` or `nvm` (installed separately) to manage versions within your user directory rather than system-wide.