Using Homebrew to manage Node.js and io.js installs on OSX
Having both Node.js and io.js installed with NVM was giving me a load of problems, mainly with npm. So I uninstalled NVM and manage Node.js and io.js with homebrew.
Install Node.js and io.js
$ brew install node
$ brew install iojs
Note the io.js install information:
This formula is keg-only. iojs conflicts with node (which is currently more established)
So we have both Node.js and io.js installed, however iojs is only linked to the command
iojs in our PATH.
So, we can unlink node:
brew unlink node, and link iojs:
brew link --force iojs this will link io.js to
node and other commands.
Now when we need to use Node.js rather than io.js, we can just
$ brew unlink iojs && brew link node
To go back to io.js
$ brew unlink node && brew link --force iojs
And we can alias these (add to .bashrc / .zshrc)
alias usenode='brew unlink iojs && brew link node && echo Updating NPM && npm install -g npm@latest && echo Using Node.js' alias useio='brew unlink node && brew link --force iojs && echo Updating NPM && npm install -g npm@latest && echo Using io.js'
Now we can
$ usenode when we want to use Node.js, and
$ useio when we want to use io.js