zsh: command not found: nvm [brew macOS]

If you recently installed nvm - Node Version Manager package using brew and when you run the nvm command you get - zsh: command not found: nvm on your macOS system. Well, the reason is you have not set the zsh profile file to locate the installed nvm package.

Let's see what we see when we install nvm using the command: brew install nvm

code2care@mac ~ % brew install nvm
==> Downloading https://github.com/creationix/nvm/archive/v0.38.0.tar.gz
Already downloaded: /Users/code2care/Library/Caches/Homebrew/downloads/1956ad942b9ae30bf5f0d9ccb61b90c5ae466dc790b470b5f766eed629b43947--nvm-0.38.0.tar.gz
==> Caveats
Please note that upstream has asked us to make explicit managing
nvm via Homebrew is unsupported by them and you should check any
problems against the standard nvm install method prior to reporting.

You should create NVM's working directory if it doesn't exist:

  mkdir ~/.nvm

Add the following to ~/.zshrc or your desired shell
configuration file:

  export NVM_DIR="$HOME/.nvm"
  [ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && . "/opt/homebrew/opt/nvm/nvm.sh" 
   # This loads nvm
  [ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && .
  # This loads nvm bash_completion

You can set $NVM_DIR to any location, but leaving it unchanged from
/opt/homebrew/opt/nvm will destroy any nvm-installed Node installations
upon upgrade/reinstall.

Type `nvm help` for further information.
==> Summary
🍺  /opt/homebrew/Cellar/nvm/0.38.0: 7 files, 176KB, built in 1 second

As you can see in the installation logs, you need to update the .zshrc file with the NVM details after you create .nvm file under ~/ location.

  1. Execute command: mkdir ~/.nvm
  2. Run command: brew --prefix nvm to know the installation location.
    code2care@mac ~ % brew --prefix nvm
  3. Open zsh profile file: nano ~/.zshrc
  4. Add the below line to the file:
    export NVM_DIR="$HOME/.nvm" 
    . "/opt/homebrew/opt/nvm/nvm.sh"
  5. Save the changes: Control + X followed by Y Key.
  6. Update changes: source ~/.zshrc
  7. Now try to run nvm commands: example: nvm list
nvm command not found zsh - brew installation
nvm command not found zsh - brew installation

Have Questions? Post them here!
Try Out Code2care Dev Tools:


Android Java Linux Microsoft Google Python macOS Notepad++ Microsoft Teams CSS PHP SharePoint Html Linux C Programs Bootstrap jQuery Sublime Android Studio Facebook Eclipse WhatsApp News MySQL Json HowTos JavaScript FTP S3


Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and Software Developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include Learnings, Tutorials, Trouble-Shooting steps, Video Tutorials, Code Snippets, How Tos, Blogs, Articles, etc.
🎉 We are celebrating the 10th years of Code2care! Thank you for all your support! We hope we made a difference.
We strong support Gender Equality & Diversity.

We stand in solidarity with Ukraine - Make a donation to UNHCR - https://donate.unhcr.org/in/en-in/ukraine-emergency