LoginSignup
177

More than 5 years have passed since last update.

Mac OSXにnodebrewをインストールする

Last updated at Posted at 2014-09-12

node.jsのバージョン管理をしやすくするためにNodebrewをインストールします。

node.jsがインストールされている場合は以下のコマンドで削除

$ brew uninstall node

Homebrewをインストール

$ brew update
$ brew install nodebrew

node.jsの最新版をインストール

$ nodebrew install latest

コンパイルにしばらく時間がかかる場合があります

Node.jsインストールされたバージョンの確認

$ nodebrew list
v0.11.13

current: none

インストールしたNode.jsバージョンを有効にする

$ nodebrew use v0.11.13

パスの設定

$ echo 'export PATH=$PATH:/Users/ユーザー名/.nodebrew/current/bin' >> ~/.bashrc

Node.jsバージョンの確認

$ node -v
v0.11.13

以上です。

Nodebrewは複数のnode.jsを管理することができ、バージョンの切り替えもしやすいです。

$ nodebrew -h
Usage:
    nodebrew help                         Show this message
    nodebrew install <version>            Download and install a <version> (compile from source)
    nodebrew install-binary <version>     Download and install a <version> (binary file)
    nodebrew uninstall <version>          Uninstall a version
    nodebrew use <version>                Use <version>
    nodebrew list                         List installed versions
    nodebrew ls                           Alias for `list`
    nodebrew ls-remote                    List remote versions
    nodebrew ls-all                       List remote and installed versions
    nodebrew alias <key> <version>        Set alias to version
    nodebrew unalias <key>                Remove alias
    nodebrew clean <version> | all        Remove source file
    nodebrew selfupdate                   Update nodebrew
    nodebrew migrate-package <version>    Install global NPM packages contained in <version> to current version
    nodebrew exec <version> -- <command>  Execute <command> specified <version>

Example:
    nodebrew install v0.10.22     Install a specific version number
    nodebrew use v0.10.22         Use a specific version number

(Kandanをインストールする際にnodebrewを使用しました)

【参考】Kandanに関してのQiitaの記事:
http://qiita.com/tags/kandan

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
177