[Node.js] Node.js: Homebrew で node.js をインストールする

以前に nodebrew でインストールしたのですが、今回は Homebrew でインストールしました。

理由としては以下のようなところ。

  • 用途が bower や grunt なので、バージョンの管理や追随をシビアに求められない。
  • Mac を Brewfile で管理・構成しやすくなる。

個人的には Homebrew にそろえた方がメリットが大きそうなので、こちらを試してみました。

nodebrew をアンインストールする

今回、クリーンインストールしたのですが、以下を試したところ問題なさそうです。

  • .zshrc などから、追加した path を削除。
  • ~/.nodebrew を削除。

※ npm 未確認。

node.js をインストールする

Homebrew の準備ができていれば、つまずくところはありませんでした。

% brew install node
==> Downloading http://nodejs.org/dist/v0.10.26/node-v0.10.26.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/node/0.10.26
==> make install
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Summary
  /usr/local/Cellar/node/0.10.26: 1121 files, 16M, built in 5.7 minutes
% node -v
v0.10.26
% npm -v
1.4.3

npm install を確認する

grunt と bower をインストールしてみましたが、下記のようにシムリンクが作られるのでパスの設定なども不要でした。

% npm install -g bower grunt-cli
    :
/usr/local/bin/grunt -> /usr/local/lib/node_modules/grunt-cli/bin/grunt
    :
/usr/local/bin/bower -> /usr/local/lib/node_modules/bower/bin/bower
grunt-cli@0.1.13 /usr/local/lib/node_modules/grunt-cli
├── nopt@1.0.10 (abbrev@1.0.4)
├── resolve@0.3.1
└── findup-sync@0.1.3 (lodash@2.4.1, glob@3.2.9)
bower@1.3.1 /usr/local/lib/node_modules/bower
├── is-root@0.1.0
├── junk@0.2.2
├── stringify-object@0.2.0
├── abbrev@1.0.4
├── which@1.0.5
├── chmodr@0.1.0
├── osenv@0.0.3
├── archy@0.0.2
├── graceful-fs@2.0.2
├── rimraf@2.2.6
├── open@0.0.4
├── lru-cache@2.5.0
├── bower-logger@0.2.2
├── bower-endpoint-parser@0.2.1
├── nopt@2.1.2
├── retry@0.6.0
├── mkdirp@0.3.5
├── tmp@0.0.23
├── q@1.0.1
├── chalk@0.4.0 (has-color@0.1.4, ansi-styles@1.0.0, strip-ansi@0.1.1)
├── semver@2.2.1
├── fstream@0.1.25 (inherits@2.0.1)
├── request-progress@0.3.1 (throttleit@0.0.2)
├── fstream-ignore@0.0.7 (inherits@2.0.1, minimatch@0.2.14)
├── bower-json@0.4.0 (deep-extend@0.2.8, intersect@0.0.3)
├── shell-quote@1.4.1 (array-filter@0.0.1, array-reduce@0.0.0, array-map@0.0.0, jsonify@0.0.0)
├── glob@3.2.9 (inherits@2.0.1, minimatch@0.2.14)
├── promptly@0.2.0 (read@1.0.5)
├── tar@0.1.19 (inherits@2.0.1, block-stream@0.0.7)
├── p-throttler@0.0.1 (q@0.9.7)
├── decompress-zip@0.0.5 (nopt@2.2.0, mkpath@0.1.0, touch@0.0.2, readable-stream@1.1.11, binary@0.3.0)
├── mout@0.9.0
├── request@2.33.0 (json-stringify-safe@5.0.0, aws-sign2@0.5.0, forever-agent@0.5.2, qs@0.6.6, tunnel-agent@0.3.0, oauth-sign@0.3.0, node-uuid@1.4.1, mime@1.2.11, tough-cookie@0.12.1, form-data@0.1.2, hawk@1.0.0, http-signature@0.10.0)
├── handlebars@1.3.0 (optimist@0.3.7, uglify-js@2.3.6)
├── cardinal@0.4.4 (ansicolors@0.2.1, redeyed@0.4.4)
├── inquirer@0.4.1 (readline2@0.1.0, mute-stream@0.0.4, through@2.3.4, async@0.2.10, lodash@2.4.1, cli-color@0.2.3)
├── update-notifier@0.1.7 (semver@2.1.0, chalk@0.2.1, request@2.27.0, configstore@0.1.7)
├── insight@0.3.1 (object-assign@0.1.2, async@0.2.10, lodash.debounce@2.4.1, request@2.27.0, configstore@0.2.2)
├── bower-config@0.5.0 (optimist@0.6.1, mout@0.6.0)
└── bower-registry-client@0.1.6 (request-replay@0.2.0, lru-cache@2.3.1, async@0.2.10, request@2.27.0, bower-config@0.4.5)
% bower -v
1.3.1
% grunt --version
grunt-cli v0.1.13