DEV Community

Clara Situma
Clara Situma

Posted on • Edited on

Install NVM on Mac, Windows and Linux

Install on macOs

To install NVM on macOS, you can use the Homebrew package manager. If you don't already have Homebrew installed, you can install it by running the following command in a terminal:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install"
Enter fullscreen mode Exit fullscreen mode

Once Homebrew is installed, you can use it to install NVM by running the following command:

brew install nvm
Enter fullscreen mode Exit fullscreen mode

Note that you may need to add the nvm command to your shell profile to make it available in all terminal sessions. You can do this by adding the following line to your shell profile configuration file (e.g. .bash_profile or .zshrc):


source $(brew --prefix nvm)/nvm.sh
Enter fullscreen mode Exit fullscreen mode

This will allow you to use the nvm command in all terminal sessions without having to re-source it each time.

Install on Windows

  1. Visit the NVM website at https://github.com/coreybutler/nvm-windows

  2. Click on the "Releases" tab, then find and click on the latest release to download the NVM installer.

  3. Once the download is complete, double-click on the downloaded installer file to run it.

  4. Follow the prompts in the installer to complete the installation process. This will install NVM and add it to your system path, allowing you to use it from the command line.

  5. Once the installation is complete, you can verify that it was successful by opening a new command prompt and running the following command:

nvm --version
Enter fullscreen mode Exit fullscreen mode

This should print the version number of NVM that is installed on your system. You can then proceed to use NVM to install and manage different versions of Node.js, as described in the previous sections.

Install on linux

To install NVM on Linux, you can use a package manager like apt-get or yum. For example, on Ubuntu you can use the following command to install NVM:


sudo apt-get install nvm
Enter fullscreen mode Exit fullscreen mode

You can verify that it was successful by opening a new command prompt and running the following command:

nvm --version
Enter fullscreen mode Exit fullscreen mode

Once NVM is installed on any of these operating systems, you can use it to install and manage different versions of Node.js, as described in the previous sections.

e.g -

To use NVM to switch to a specific version of Node.js, you can run the following command:


nvm use <version>
Enter fullscreen mode Exit fullscreen mode

Replace with the version of Node.js you want to use. For example, to switch to version 12.18.3, you would run:


nvm use 12.18.3
Enter fullscreen mode Exit fullscreen mode

This will set the version of Node.js that is used by default for new terminal sessions.

Top comments (0)