petrhurtak.com site logopetrhurtak.com

How to switch Node version on macOS

The easiest way to install and switch between different versions of Node.js is with Homebrew package manager.

Search and install versions

ActionCommand
Currently active versionnode --version
Search available and installed versionsbrew search node
Install latest versionbrew install node
Install older versionbrew install node@16

Change version

ActionCommand
Unlink latest versionbrew unlink node
Unlink older versionbrew unlink node@16
Link latest versionbrew link node && brew postinstall node
Link older versionbrew link --overwrite node@16

Alternatives