You can install Node.js using the Homebrew package manager.
Start by updating brew:
brew update
You may need to change permissions or paths. It's best to run this before proceeding:
brew doctor
Next you can install Node.js by running:
brew install node
Once Node.js is installed, you can validate the version installed by running:
node -v
You can also install node.js through Macports.
First update it to make sure the lastest packages are referenced:
sudo port selfupdate
Then install nodejs and npm
sudo port install nodejs npm
You can now run node through CLI directly by invoking node
. Also, you can check your current node version with
node -v