New Check out the curated list of the finest design resources I've gathered for you! Take a look →

How to Install NVM Using Homebrew on a Mac

Are you looking to install NVM (Node Version Manager) on your Mac using Homebrew?

This guide will walk you through the step-by-step process of installing NVM on your Mac. By the end of this tutorial, you will be able to easily manage and switch between different versions of Node.js.

What is NVM (Node Version Manager)?

NVM, or Node Version Manager, is a tool that allows you to install, update, and switch between different versions of Node.js on your system. This is particularly useful for developers who need to work with multiple projects that require different Node.js versions.

How to Check if NVM is Installed

Before we begin the installation process, let’s check if NVM is already installed on your system. Open Terminal and run the following command:

nvm --version

If NVM is installed, this command will display the version number. If not, you will see a command not found message.

Install NVM Using Homebrew

Follow these steps to install NVM using Homebrew:

Step 1: Open Terminal on Your Mac

You can do this by searching for “Terminal” in Spotlight or navigating to Applications > Utilities > Terminal.

Step 2: Install Homebrew

If Homebrew is not already installed, you can install it by executing the following command in Terminal:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

This command will download and install Homebrew on your Mac.

Step 3: Update Homebrew

Once Homebrew is installed, run the following command to update it to the latest version:

brew update

Step 4: Install NVM

Next, install NVM using Homebrew by running the following command:

brew install nvm

Step 5: Add the NVM Environment Variables

After the installation is complete, add the NVM environment variables to your shell profile. You can do this by running the following command:

echo 'export NVM_DIR="$HOME/.nvm"' >> ~/.bash_profile
source $(brew --prefix nvm)/nvm.sh

Note: If you are using the Zsh shell, replace ~/.bash_profile with ~/.zshrc.

Step 6: Reload Your Shell Profile to Apply the Changes

To apply the changes, reload your shell profile by running:

source ~/.bash_profile

Or, if you are using Zsh:

source ~/.zshrc

Step 7: Verify the Installation

To verify that NVM is installed correctly, run the following command:

nvm --version

This should display the version of NVM installed on your Mac.

NVM Installed

I hope this article helped you learn how to install NVM using Homebrew on your Mac. You may also want to check out my other WordPress tutorials.

Rizwan Aritonang

An independent WordPress & Front-End Developer from Bandung, Indonesia.

Get In Touch

Leave a Comment