I suppose you already installed homebrew nad have one current version of node installed.
Reference taken from https://gist.github.com/kugaevsky/68a7fa894551da9c310a
First, add an older formula of node:
$ cd /usr/local
$ git checkout b64d9b9c431642a7dd8d85c8de5a530f2c79d924 Library/Formula/node.rb
$ brew unlink node
$ brew install node
$ npm install -g npm@latest
Then use brew switch
:
$ brew switch node 0.12.2_1
Cleaning /usr/local/Cellar/node/0.10.36
Cleaning /usr/local/Cellar/node/0.12.2_1
6 links created for /usr/local/Cellar/node/0.12.2_1
$ node -v
v0.12.2
and switch back again!
$ brew switch node 0.10.36
Cleaning /usr/local/Cellar/node/0.10.36
Cleaning /usr/local/Cellar/node/0.12.2_1
5 links created for /usr/local/Cellar/node/0.10.36
$ node -v
v0.10.36
Very powerful indeed.
I had to run
brew link --overwrite node
before this would work. Why?