How to Install NVM (Node Version Manager) on macOS

How to Install NVM (Node Version Manager) on macOS


node.js nvm macos

Node Version Manager (NVM) is a command-line tool that allows you to install and manage multiple versions of Node.js on your system. It’s especially helpful for developers who need to switch between different Node.js versions for various projects. In this guide, we’ll walk you through the process of installing NVM on macOS using the terminal.


🛠️ Prerequisites

Before you begin, ensure that you have the following:

  • macOS system (any version)
  • Homebrew installed (optional but recommended for managing packages)

If you don’t have Homebrew installed, you can follow the installation guide on Homebrew’s official site.


1. Install NVM Using the Terminal

Step 1: Open the Terminal

First, open the Terminal application on your Mac. You can find it in the Applications folder under Utilities or by searching “Terminal” in Spotlight.

Step 2: Install NVM with Curl

To install NVM, run the following command in your terminal:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash

This command downloads and runs the NVM installation script. It will automatically add the necessary configuration to your shell profile.

Step 3: Install NVM with Wget (Alternate Method)

If you prefer using wget, you can install NVM with the following command:

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash


2. Verify Installation

Once the installation is complete, you need to restart your terminal or reload your shell profile. To verify if NVM has been successfully installed, run the following command:

command -v nvm

If the terminal outputs nvm, it means the installation was successful.


3. Use NVM to Install Node.js Versions

Now that NVM is installed, you can use it to install multiple versions of Node.js. For example, to install the latest version of Node.js, run:

nvm install node

If you want to install a specific version of Node.js, use the following command:

nvm install 14.17.0

Replace 14.17.0 with the desired Node.js version.


4. Switch Between Node.js Versions

You can easily switch between different versions of Node.js using NVM. To use a specific version, run:

nvm use 14.17.0

To check the installed versions and the currently active version, run:

nvm ls


5. Set a Default Node.js Version

If you want to set a default Node.js version, run the following command:

nvm alias default 14.17.0

This will make Node.js v14.17.0 the default version every time you open a new terminal window.


⚡ Benefits of Using NVM

  • Multiple Versions: Easily install and switch between multiple versions of Node.js.

  • Compatibility: Ensure compatibility with different projects by using specific Node.js versions.

  • Simplicity: Manage Node.js versions with simple commands, without the need to manually update or uninstall versions.


📝 Conclusion

NVM is a powerful tool that helps Node.js developers manage and switch between different Node.js versions on their Mac. By following the steps outlined above, you can easily install NVM and start using it for your development needs. Whether you’re working on multiple projects with different Node.js requirements or just need to upgrade your Node.js version, NVM makes version management simple and efficient.

For further details, refer to the official NVM documentation.


Current Benefits:

  • Easily manage multiple versions of Node.js

  • Switch versions without reinstalling Node.js

  • Compatible with various projects and environments

Thank you for stopping by

© 2025 - Oktaviardi.com