How to Brew Install Specific Version of Node?

Avoid using the latest Node.js if not needed. Use Homebrew to install specific versions like node@18 and manage your PATH settings.

Summarize with AI

Not enough time? get the key points instantly.

Install a specific Node.js version on macOS with brew install node@ or nvm. Make sure to link manually and manage PATH for usage.

Problem

On macOS developers want to install or switch to a specific Node.js version. Using Homebrew’s default install command always installs the latest NodeJS version which might not be compatible with your app or tooling.

Solution

Use Node Version Manager (nvm) for more control or install specific versions via Homebrew with the node@ formula.

Option 1- Use nvm

bash

brew install nvmnvm install 18

nvm use 18

Option 2- Install a specific version via Homebrew

bash

brew install node@18To link it manually:

bash

brew link –overwrite –force node@18

Set PATH if needed

bash

export PATH=”/opt/homebrew/opt/node@18/bin:$PATH”

You can now check:

bash

node -v

For long term use add the path export to your shell profile (e.g., .zshrc or .bash_profile).

Also Read:

Conclusion

Use nvm for flexibility or brew install node@ for targeted installs. Always verify your path and version with node -v.


Resources

Insights from our engineering leaders.

Our team shares practical insights on the technologies and engineering decisions shaping enterprise software today, grounded in real client work.

NodeJS

Which Company Is Best for Hiring Node.js Developers in the UK?

Node.js helps businesses build backend systems, REST APIs, real-time applications, and SaaS platforms using JavaScript. Developing these solutions requires professionals who understand application architecture, technical…

NodeJS

How to tell if Node.js is installed or not?

To verify Node.js installation, run node -v or node --version. This checks if Node.js is installed and working correctly. Problem Before you run any Node.js…