Let’s do install Node.
you have two ways to install in Mac OS X.
The easiest way to install node is with the package manager.
- Go to https://nodejs.org/en/download/
- Download Mac installer version
- Execute and follow step by step
Homebrew is defined as package manager that OS X should have. First, we need to install homebrew. Open a terminal window and write:
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
After some text, you can test it works:
$ brew -v
Homebrew/homebrew-core (git revision 501b; last commit 2017-06-27)
Now we can install Node:
$ brew install node
And after some more text, you will be Node.JS installed.
If you open a terminal and write:
$ node -v && npm -v
You will have the version output:
Why use Homebrew instead Installer
Why is better to use homebrew instead installer? Easy, you need administrative privileges to install, this means use sudo to install with package installer and are a big problem for working with it. You will need use sudo in front of node and this one doesn’t like execution with root privileges. To avoid this problem use Hombrew to install it.