homebrewでnode.jsをインストール&管理する
ソフトのインストールは極力管理ソフト経由で行いたい、そうしないと依存関係の管理がめんどくさいので。
さて残念ながらデフォルトのhomebrewではnode.jsをインストールする事ができない。
そこで、外部パッケージを活用してhomebrewに設定を追加する事で、node.js/npmをインストールする。
下記、サイトを参考にして導入してみましたがgithub上のリンクが切れていたため、新しいアドレスでインストールを行いました。
$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
(一部省略)
==> Downloading http://nodejs.org/dist/v0.6.18/node-v0.6.18.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/node/0.6.18 --without-npm
==> make install
==> Caveats
Homebrew has NOT installed npm. We recommend the following method of
installation:
curl http://npmjs.org/install.sh | sh
After installing, add the following path to your NODE_PATH environment
variable to have npm libraries picked up:
/usr/local/lib/node_modules
==> Summary
/usr/local/Cellar/node/0.6.18: 80 files, 7.7M, built in 3.7 minutes
(次にnpmをインストールする)
$ curl http://npmjs.org/install.sh | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 7881 100 7881 0 0 9057 0 --:--:-- --:--:-- --:--:-- 19459
tar=/usr/bin/tar
version:
bsdtar 2.8.3 - libarchive 2.8.3
install npm@1.1
fetching: http://registry.npmjs.org/npm/-/npm-1.1.23.tgz
0.6.18
1.1.23
(一部省略)
$ node -v
v0.6.18
$ npm -v
1.1.23サクッと成功。