Mac - Installing Node.js¶
There are multiple ways to install Node.js on a Mac; however, the preferred method is to utilize the direct Homebrew install.
To install Node.js using Homebrew:¶
-
Ensure Homebrew is installed
-
Open a terminal window and run the following command:
# Replace 18 with whatever version of Node you want installed brew update && brew install node@18
To install Node.js using nvm homebrew formula:¶
-
Open a terminal window and run the following commands:
brew install nvm mkdir ~/.nvm if [[ "$SHELL" == *zsh ]]; then SDE_SHELL_PROFILE=$HOME/.zshrc; else export SDE_SHELL_PROFILE=$HOME/.bash_profile; fi echo export NVM_DIR=~/.nvm >>$SDE_SHELL_PROFILE echo source $(brew --prefix nvm)/nvm.sh >>$SDE_SHELL_PROFILE source $SDE_SHELL_PROFILE nvm install node nvm use --lts node --version npm install -g aws-cdk npm install -g aws-cdk-lib
Note
Using this method can increase the load time of your
.bashrc
or.zshrc
file.
To manually install Node.js:¶
- Download and run the Node.js macOS pkg.