You can install Node.js using the Homebrew package manager.
Start by updating brew:
You may need to change permissions or paths. It's best to run this before proceeding:
Next you can install Node.js by running:
brew install node
Once Node.js is installed, you can validate the version installed by running:
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