MacでCoffeeScriptを簡単にインストールする

久々にHemebrewをアップデートしてみました

$ brew update

すると更新一覧の中に見慣れた名前がありました。

==> The following formulae were updated:
coffee-script

おぉっ!?
今までみたいに、 node → npm → coffee-script のインストール手順を踏まなくてもいいの!?

というか、どんな風にインストールされるのか気になったのでさっそく試してみました。


まずは、元から入れていたCoffeeScriptを削除します。
(CoffeeScriptをインストールしていない場合は不要)

npm uninstall -g coffee-script


そしてすかさずHomebrewでインストールします。

brew install coffee-script


すると Node.js のインストールが開始されました。

==> Downloading http://nodejs.org/dist/node-v0.4.9.tar.gz######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/node/0.4.9
==> make install
==> Caveats
Please add /usr/local/lib/node to your NODE_PATH environment variable to have node libraries picked up.
==> Summary
/usr/local/Cellar/node/0.4.9: 72 files, 7.6M, built in 4.6 minutes
==> Downloading https://github.com/jashkenas/coffee-script/tarball/1.1.1
######################################################################## 100.0%
==> ./bin/cake --prefix /usr/local/Cellar/coffee-script/1.1.1 install
==> Caveats
coffee-script can also be installed via `npm install coffee-script`.
This has the advantage of supporting multiple versions (of any Node libs)
at the same time.

Since coffee-script syntax changed pretty drastically between 0.7.2 and
0.9.x, you may want to install it via npm instead.

This formula may be retired from a future version of Homebrew.
==> Summary
/usr/local/Cellar/coffee-script/1.1.1: 34 files, 496K, built in 2 seconds

ふむふむ。なるほど。

Node.js のインストールが完了すると、CoffeeScriptがリポジトリから直接インストールされます。


npm 経由でインストールされていないのでアップデートする際は手動で行う必要がありそうですが、
ちょっとにCoffeeScriptを試してみたい、という場合にはとても楽だと思いました。