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.

Install a specific Node.js version on macOS with brew install node@<version> 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 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@<version> 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
Also Read: Building A Node JS MVC Application

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).

Conclusion

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

How to Get the Project Root Path in Node.js When working with large Node.js projects, you often need to find the root directory at runtime…

15 Oct, 2025

If you’re trying to run nodemon from the terminal and see the error: nodemon: command not found, it usually means the nodemon package is not…

10 Oct, 2025

Writing to files is a common task in Node.js, whether for logging, saving uploads or creating reports. Node.js has various methods through the built-in fs…

07 Oct, 2025