To resolve this issue, ensure that nvm is properly set up in your shell configuration. Since you are using zsh, add the following lines to your .zshrc file:

brew upgrade
brew install nvm
echo 'export NVM_DIR="$HOME/.nvm"' >> ~/.zshrc
echo '[ -s "$(brew --prefix nvm)/nvm.sh" ] && \. "$(brew --prefix nvm)/nvm.sh"' >> ~/.zshrc
echo '[ -s "$(brew --prefix nvm)/etc/bash_completion.d/nvm" ] && \. "$(brew --prefix nvm)/etc/bash_completion.d/nvm"' >> ~/.zshrc
source ~/.zshrc

After running these commands, nvm should be set up correctly. You can verify the installation by checking the nvm version:

$ nvm --version
Answer from hemant jangra on Stack Overflow
🌐
GitHub
github.com › nvm-sh › nvm
GitHub - nvm-sh/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions
nvm is a version manager for node.js, designed to be installed per-user, and invoked per-shell. nvm works on any POSIX-compliant shell (sh, dash, ksh, zsh, bash), in particular on these platforms: unix, macOS, and windows WSL.
Starred by 90.4K users
Forked by 9.7K users
Languages   Shell 98.0% | Makefile 1.2%
🌐
Medium
sukiphan.medium.com › how-to-install-nvm-node-version-manager-on-macos-d9fe432cc7db
How to install NVM (Node Version Manager) on macOS | by Suki Nhung Phan | Medium
December 26, 2023 - How to install NVM (Node Version Manager) on macOS Hi, I’m Suki, front-end developer. Meanwhile working on my personal project, I encountered a situation where the project required Node version 18 …
Top answer
1 of 4
115

To resolve this issue, ensure that nvm is properly set up in your shell configuration. Since you are using zsh, add the following lines to your .zshrc file:

brew upgrade
brew install nvm
echo 'export NVM_DIR="$HOME/.nvm"' >> ~/.zshrc
echo '[ -s "$(brew --prefix nvm)/nvm.sh" ] && \. "$(brew --prefix nvm)/nvm.sh"' >> ~/.zshrc
echo '[ -s "$(brew --prefix nvm)/etc/bash_completion.d/nvm" ] && \. "$(brew --prefix nvm)/etc/bash_completion.d/nvm"' >> ~/.zshrc
source ~/.zshrc

After running these commands, nvm should be set up correctly. You can verify the installation by checking the nvm version:

$ nvm --version
2 of 4
13

Looking at the warning which you added in your question, I surmise that nvm is installed on your machine but may not have been setup properly. Nevertheless, adding full steps for you to verify which one you missed and fix the same.

1. Confirm nvm is installed

Before making changes, check if nvm exists:

# confirm nvm is installed
$ brew list | grep nvm
# if the above doesn't return anything, install nvm
$ brew install nvm

2. Ensure your system is in good shape

Sometimes Homebrew issues prevent nvm from working properly. For that run:

$ brew doctor
# If you see any warnings, follow the suggested fixes and 
# rerun brew doctor until everything looks good. 

3. Create the nvm directory (if missing)

$ mkdir -p ~/.nvm

4. Add nvm to your shell configuration

Manually add these lines to ~/.zshrc:

export NVM_DIR="$HOME/.nvm"
[ -s "$(brew --prefix nvm)/nvm.sh" ] && . "$(brew --prefix nvm)/nvm.sh"
[ -s "$(brew --prefix nvm)/etc/bash_completion.d/nvm" ] && . "$(brew --prefix nvm)/etc/bash_completion.d/nvm"

Save the file and reload the configuration:

$ source ~/.zshrc

5. Verify and Restart

Check if nvm is now working:

$ nvm -v

If you still get an error, restart your terminal and try again. Sometimes failing to do this might also lead to issues.

🌐
Reddit
reddit.com › r/webdev › nvm or homebrew for node install
r/webdev on Reddit: Nvm or homebrew for Node install
April 12, 2023 -

I come across this decision every time I get a new Mac laptop/computer.

I like nvm, node version manager, because it allows me to install multiple versions of node/npm in case I need to switch within different versions.

Does homebrew offer the same? Are there other install recommendations for Mac?

The need to switch node versions does come up when asked to work on another project that is “stuck” on an older version of node due to outdated packages that no one wants to maintain but is still used in the project.

April 12, 2023 Update Thanks for all the great recommendations and insight. I decided to use fnm for my own preference at this time, but all alternatives seem great in their own way. Here is a great article from Honeybadger comparing many node environment managers: https://www.honeybadger.io/blog/node-environment-managers

🌐
Catalin's Tech
catalins.tech › node-version-manager-macos
Install and Use Node Version Manager (NVM) on macOS
March 11, 2024 - This article teaches you how to install Node Version Manager on macOS and the most common & useful NVM commands.
🌐
freeCodeCamp
freecodecamp.org › news › node-version-manager-nvm-install-guide
Node Version Manager – NVM Install Guide
September 9, 2022 - NVM is mostly supported on Linux and Mac. It doesn't have support for Windows. But there's a similar tool created by coreybutler to provide an nvm experience in Windows called nvm-windows. nvm-windows provides a management utility for managing Node.js versions in Windows.
🌐
Medium
medium.com › @alvaro.apavon › como-instalar-nvm-node-versión-manager-en-macos-chip-apple-con-brew-0cb56eb1605a
Como instalar NVM (Node Versión Manager) en MacOs (chip Apple) con brew | by Alvaro Alejandro Pavon Torres | Medium
October 26, 2023 - Como instalar NVM (Node Versión Manager) en MacOs (chip Apple) con brew NVM nos permite instalar y usar diferentes versiones de NodeJS mediante la línea de comandos. Esta funcionalidad nos es de …
🌐
daily.dev
daily.dev › home › blog › webdev › how to use multiple node versions with nvm on macos - node version manager
How To Use Multiple Node Versions With NVM On MacOS - Node Version Manager
November 1, 2021 - After installing the Node version ... version of Node by running nvm use --lts. The Node Version Manager is a handy tool to switch between Node versions....
Find elsewhere
🌐
GitHub
github.com › tj › n
GitHub - tj/n: Node version management
Node.js version management: no subshells, no profile setup, no convoluted API, just simple. ... n is supported on macOS, Linux, including with Windows Subsystem for Linux, and various other unix-like systems.
Starred by 19.4K users
Forked by 765 users
Languages   Shell 99.8% | Makefile 0.2%
🌐
Collabnix
collabnix.com › how-to-install-and-configure-nvm-on-mac-os
How to install and Configure NVM on Mac OS - Collabnix
nvm (Node Version Manager) is a tool that allows you to install and manage multiple versions of Node.js on your Mac. nvm is a version manager for node.js, designed to be installed per-user, and invoked per-shell. nvm works on any POSIX-compliant shell (sh, dash, ksh, zsh, bash), in particular ...
🌐
Homebrew
formulae.brew.sh › formula › nvm
nvm — Homebrew Formulae
Manage multiple Node.js versions · https://github.com/nvm-sh/nvm · License: MIT · Formula JSON API: /api/formula/nvm.json · Formula code: nvm.rb on GitHub · Bottle (binary package) installation support provided.
🌐
Nvmnode
nvmnode.com
NVM - Node.js Version Manager tool - NVM Documentation
NVM is a tool for managing multiple versions of Node.js, Official documentation for NVM (Node Version Manager) for Windows, Linux, and macOS
🌐
GitHub
github.com › NVM-Mac
NVM Mac · GitHub
NVM for Mac allows you to manage and switch between multiple versions of Node.js on macOS with ease. It's essential for developers working on diverse Node. - NVM Mac
🌐
TecAdmin
tecadmin.net › install-nvm-macos-with-homebrew
How to Install and Configure NVM on macOS
April 26, 2025 - Node Version Manager (NVM) is popular among developers for installing and managing multiple versions of Node.js on a single machine. This allows developers to work on multiple projects that require different versions of Node.js.
🌐
GitHub
github.com › NVM-MacOS
NVM MacOS · GitHub
NVM (Node Version Manager) for Mac is a command-line utility that allows you to easily install, manage, and switch between multiple versions of Node.js on macOS.
🌐
YouTube
youtube.com › watch
How to Install and Use NVM (Node Version Manager) on Mac & Linux - YouTube
Easily switch between Node.js versions using NVM (Node Version Manager) on Mac and Linux!In this step-by-step guide, you’ll learn how to install and use NVM ...
Published   June 23, 2025
🌐
Medium
medium.com › devops-techable › how-to-install-nvm-node-version-manager-on-macos-with-homebrew-1bc10626181
How To Install NVM (Node Version Manager) on macOS with Homebrew | by Paris Nakita Kejser | DevOps Engineer, Software Architect and Software Developering | Medium
February 28, 2022 - How To Install NVM (Node Version Manager) on macOS with Homebrew Node Version Manager (NVM) is used to develop NodeJS applications in multi versions, if you install NodeJS native on your system you …