brew install nvm and brew cask install nvm code example
Example 1: install nvm with brew
brew update
brew install nvm
mkdir ~/.nvm
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
Example 2: homebrew nvm install
"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"