You're trying to manage Node.js versions and everything is a mess. Maybe you inherited a legacy project that demands Node 14, but your personal side project is screaming for Node 22. Honestly, the "official" way of installing Node from a .pkg installer is usually the first mistake people make. It litters your /usr/local/bin with files you can't easily track. That's why you're here. Learning to install nvm on Mac is basically a rite of passage for web developers.
NVM, or Node Version Manager, acts like a switcher. It's a bash script that lets you jump between versions without sudo permissions or headaches. But if you've ever tried to set it up and ended up with command not found: nvm, you know it’s not always a one-click affair. Apple’s shift from Bash to Zsh a few years ago tripped up a lot of the old tutorials.
Why Brew Isn't Always the Answer
Most Mac users instinctively reach for Homebrew. It’s great. I love Brew. But here's the kicker: the official NVM maintainers actually discourage installing it via Homebrew.
Wait, what?
Yeah, it's true. If you check the official repository, they explicitly state that Homebrew installations are "unsupported." The reason is that Brew-installed NVM often runs into path conflicts or issues when Homebrew updates itself. It can lead to a scenario where your Node versions just... disappear. Or your shell takes five seconds to load because the Brew script is hunting for dependencies. Using the direct install script is usually the cleaner path, even if it feels a bit more manual.
Checking Your Shell
Before we do anything, you need to know what shell you’re running. Open your Terminal. Type echo $SHELL.
If it says /bin/zsh, you’re on the modern Mac standard. If it says /bin/bash, you’re likely on an older machine or you’ve manually switched it. This matters because NVM needs a "home" in your configuration files—either .zshrc or .bash_profile.
✨ Don't miss: Finding a Phone Number for Google Customer Service: What Actually Works in 2026
The Step-by-Step Way to Install nvm on Mac
Let's get into the weeds. We aren't going to use a fancy installer. We're using the terminal.
First, you’ll want to run the install script. You can use cURL or Wget. Most Macs have cURL ready to go. Run this:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
(Note: Always check the latest version number on GitHub; v0.40.1 is current as of late 2024/early 2025, but it moves fast.)
Once that runs, it looks like it's done. You’ll see a bunch of text. You might feel tempted to type nvm --version right away. Don't. It will fail. You'll get that annoying "command not found" error because your current terminal session doesn't know the new script exists yet.
The Part Everyone Forgets: The Profile
You have to tell your shell to load NVM every time you open a window. If you're on Zsh (which you probably are), you need to edit your .zshrc file.
- Type
nano ~/.zshrcin your terminal. - If the file is empty, that's fine. If it's full of stuff, scroll to the bottom.
- Paste the following block:
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && echo "$HOME/.nvm" || echo "$XDG_CONFIG_HOME/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
Hit Ctrl + O, then Enter to save, and Ctrl + X to exit.
🔗 Read more: Why Download YouTube Videos Free Mac Users Still Struggle and What Actually Works
Now, restart your terminal. Seriously. Close it completely and reopen it. Or, if you're lazy, type source ~/.zshrc. Now try nvm --version. If a version number pops up, you've successfully managed to install nvm on Mac.
Actually Using the Darn Thing
Great, it's installed. Now what? You don't actually have Node yet. NVM is just the manager; the office is still empty.
To get the latest version of Node, you’d run nvm install node. This gives you the "Current" version, which is usually the one with the latest features but maybe a bit less stability. For production work, you probably want the LTS (Long Term Support) version.
Run this: nvm install --lts.
Suddenly, you have a stable Node environment. If you need a specific version, say version 18.16.0, you just type nvm install 18.16.0.
Managing Versions Like a Pro
The beauty of NVM is switching. Imagine you're working on an old project.
nvm lsshows you everything you have installed.nvm use 20switches your current session to Node 20.nvm alias default 20makes sure that every time you open a new terminal, it starts with Node 20.
Common Pitfalls and Apple Silicon (M1/M2/M3)
If you're on a newer Mac with Apple Silicon, you might run into weirdness with older Node versions (like anything pre-v15). These versions weren't built for ARM architecture.
If you absolutely must run an ancient version of Node on an M3 Max, you might need to run your terminal under Rosetta 2. But honestly? Try to avoid it. Most modern projects have moved past those versions. If you see "Architecture mismatch" errors, that’s your Mac telling you that you’re trying to run Intel code on an ARM chip without a translator.
Another thing: Permissions. If you find yourself typing sudo to install a global npm package (like sudo npm install -g typescript), stop. Something is wrong. One of the main benefits of using NVM is that it keeps Node in your home directory (~/.nvm). This means you own the files. You should never need sudo for npm packages when using NVM. If you do, it usually means there’s a ghost version of Node installed via Homebrew or a PKG installer that’s clashing with NVM.
How to Fix a "Broken" NVM Path
Sometimes, macOS updates or software installs mess with your .zshrc file. If NVM suddenly stops working, the first thing to check is that code block we pasted earlier. Mac's path priority can be a fickle beast.
Check your path by typing echo $PATH. You should see ~/.nvm/versions/node/v.../bin somewhere near the start. If it's at the very end, other versions of Node might be "hijacking" your commands.
Moving Forward With Your Setup
Once you've got it running, the next step is usually setting up a .nvmrc file in your projects. This is a tiny file that just contains a version number, like 20.10.0. When you navigate into that folder, you can just type nvm use, and NVM will look at the file and switch to the right version automatically. It saves so much time during onboarding.
Actionable Next Steps
- Audit your current Node: Run
which node. If it says/usr/local/bin/node, you have a manual install. Consider uninstalling it before NVM gets confused. - Install the LTS: Get that stable foundation with
nvm install --lts. - Clean up your global packages: Remember that when you switch Node versions, your global packages (like
yarnornodemon) don't carry over automatically. You’ll need to reinstall them for the new version or use the--reinstall-packages-fromflag during installation. - Automate shell switching: Look into "Zsh auto-switch" scripts that run
nvm useautomatically whenever youcdinto a directory with a.nvmrcfile. It’s a game changer for productivity.
You're now set up with a professional-grade Node environment. No more permission errors, no more "it works on my machine" drama—just clean, versioned development.