The simplest way to install Node Version Manager on mac is via Homebrew. If you have not already done so you can go here.
Once you installed home brew you can run:
brew install nvm
After it’s installed, you should see a note to copy and paste into you shell profile and
add the following lines to your shell profile file (e.g., ~/.bashrc, ~/.zshrc, or ~/.bash_profile):
export NVM_DIR=~/.nvm
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
Then, restart your terminal by closing or run source ~/.your_shell_profile to apply the changes.
To check nvm is working correctly, you can see what version is installed.
nvm --version
To install the Long-term Support. I would highly recommend.
nvm install --lts
But default this will switch to that version.
If you can a specific version you can run:
nvm ls-remote
Then install the version you require.
nvm install v22.21.0
NVM is powerful tool, if you’re working with many different version of Node.JS projects.

Comments are closed