Install Nodejs & NPM by Brew

Problem

Need quick script for install NPM & Node by terminal.

Solution

Homebrew - the missing package manager for OS X, really easy way to setup environment.

Open terminal and check Brew version:

$ brew -v

If you get “brew: command not found” got to official web page and copy/paster url link for install, for example:

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

If on Mac don’t install Xcode you see alert message with option for install. Node.js & NPM don’t need Xcode, so cancel Xcode installation alert message.

Then installing the NPM & Node by command:

$ brew node

Done!

Screenshot

Check installed versions

For check nodejs/NPM version/location use:

$ node -v
$ which node
$ npm -v
$ which npm

Have fun with Nodejs!