Skip to content

Instantly share code, notes, and snippets.

@mike-casas
Last active January 19, 2026 14:51
Show Gist options
  • Select an option

  • Save mike-casas/6d489bebf48d89f5109cd1395aabe150 to your computer and use it in GitHub Desktop.

Select an option

Save mike-casas/6d489bebf48d89f5109cd1395aabe150 to your computer and use it in GitHub Desktop.
install nvm on mac with zsh shell
After install zsh
- brew update
- brew install nvm
- mkdir ~/.nvm
after in your ~/.zshrc or in .bash_profile if your use bash shell:
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
@mike-casas
Copy link
Author

I use

  • Mac os Big Sur (11.7.4)
  • zsh instead of bash

When I restart terminal, it doesn't recognise the nvm command. What should I do to solve this issue with .zshrc?

Thanks for your help

please recheck in your ~/.zshrc file this lines :

export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh

@js-Quest
Copy link

thanks so much

@shrsing3
Copy link

shrsing3 commented Dec 6, 2023

/Users/shrsing3/.zshrc:59: command not found: brew
/Users/shrsing3/.zshrc:source:59: no such file or directory: /nvm.sh

I get the following error every time I open a new terminal session

@mike-casas
Copy link
Author

/Users/shrsing3/.zshrc:59: command not found: brew
/Users/shrsing3/.zshrc:source:59: no such file or directory: /nvm.sh

I get the following error every time I open a new terminal session

please try next lines in your .zshrc file in terminal

open ~/.zshrc

in the .zshrc add the next lines

export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh

@fernandobusta
Copy link

Thanks! was about to waste an hour...

@vickfaby
Copy link

thank you! <3

@GatesKennedy
Copy link

Thank you!

@Sinabon2004
Copy link

thank you! 💟

@ShahQaysEzypay
Copy link

thank you. This worked!

@SayedDileri
Copy link

Absolute legend!! Cheers!!

@duggiemitchell
Copy link

Hats off to you! 🎩

@onwp
Copy link

onwp commented Jan 31, 2025

i was looking for the addition part in zshrc. because default one was making it slow. this helped. thanks!

@phr88xxx
Copy link

Works like a charm! Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment