Use io.js and Node.js with Homebrew at OS X
Install [io.js] and [Node.js] with [homebrew] is super easy:
brew install iojs node
But you make notice this message for io.js formula:
This formula is keg-only.
iojs conflicts with node (which is currently more established)
Because of io.js uses node
for its binary’s name, so Homebrew won’t link io.js’s binary to /usr/local/bin
, unless force to link with command brew link iojs --force
. That means you can’t use io.js directly (e.g. node app.js
). You have to use absolute path (e.g. /usr/local/Cellar/iojs/1.0.4/bin/node app.js
), or use nvm:
nvm use 0.11
node -v v0.11.15
nvm use iojs
node -v v1.0.4
Although it can work, but you have to change asolute path after io.js updated, or nvm
may be unavailable in some situations (e.g. needs source $NVM_PATH/nvm.sh
). It’s inconvenience. So I created a shell script to help things easier:
!/usr/bin/env sh
if [ -d "$(brew --prefix)/Cellar"
...