Install NVM on macOS with Homebrew — vetechno
If you have Homebrew installed on your Mac, you can use it to install Node Version Manager (NVM).
You can use the following command to install nvm using Homebrew:
brew install nvm
Once the installation is complete, you’ll need to add the following line to your shell profile file (e.g., ~/.bash_profile, ~/.zshrc)
source $(brew — prefix nvm)/nvm.sh
Then open a new terminal window or source the profile file to start using nvm:
source ~/.bash_profile
After NVM is installed and set up, you can use it to install, manage and switch between different versions of Node.js. You can use the following command to see a list of available Node.js versions:
nvm ls-remote
You can use the following command to install a specific version of Node.js:
nvm install 12.18.4
You can also use the following command to see the version of Node.js that is currently in use:
nvm current
and you can use the following command to switch to a different version of Node.js:
nvm use 12.18.4
These are the basic usage of NVM. For more options and functionality you can check out the official documentation: https://github.com/nvm-sh/nvm
Also you can use the brew command to check the version of NVM that you have installed and to check for any updates
brew list nvm
brew upgrade nvm