[Mac] How to Install Node.js and npm [Homebrew]

Tadashi Shigeoka ·  Sat, November 5, 2011

I researched how to install Node.js and npm on Mac, so here’s a memo.

Install node.js with homebrew

$ brew install node

Verify that it was installed successfully:

$ node -v
v0.4.11

 

Cannot install npm with homebrew...

The Homebrew npm formula was recently removed as it doesn’t comply with their inclusion policy (https://github.com/mxcl/homebrew/wiki/Acceptable-Formula).

As the message suggests, it should be installed with curl http://npmjs.org/install.sh | sh.

$ brew install npm
Error: No available formula for npm
npm can be installed thusly by following the instructions at
  http://npmjs.org/

To do it in one line, use this command:
  curl http://npmjs.org/install.sh | sh

 

Install npm via curl

$ curl http://npmjs.org/install.sh | sh

Verify that it was installed successfully:

$ npm -v
1.0.103

That’s all.


Reference Information

node.jsとnpmのインストール - 自分の感受性くらい

MacOSXでnode.js/npm/nvmをインストール - tagomorisのメモ置き場

That’s all from the Gemba.