What is the suggested way to install brew, node.js, io.js, nvm, npm on OS X?
Using
homebrew
installnvm
:brew update brew install nvm source $(brew --prefix nvm)/nvm.sh
Add the last command to the
.profile
,.bashrc
or.zshrc
file to not run it again on every terminal start. So for example to add it to the.profile
run:echo "source $(brew --prefix nvm)/nvm.sh" >> ~/.profile
If you have trouble with installing
nvm
usingbrew
you can install it manually (see here)Using
nvm
installnode
oriojs
(you can install any version you want):nvm install 0.10 # or nvm install iojs-1.2.0
npm
is shipping withnode
(oriojs
), so it will be available after installingnode
(oriojs
). You may want to upgrade it to the latest version:$ npm install -g npm@latest
UPD Previous version was
. Thanks to @Metallica for pointing to the correct way (look at the comment bellow).npm update -g npm
Using
npm
installionic
:npm install -g ionic
What about
ngCordova
: you can install it usingnpm
orbower
. I don't know what variant is more fit for you, it depends on the package manager you want to use for the client side. So I'll describe them both:Using
npm
: Go to your project folder and installng-cordova
in it:npm install --save ng-cordova
Using
bower
: Install bower:npm install -g bower
And then go to your project folder and install
ngCordova
in it:bower install --save ngCordova
PS
- Some commands may require superuser privilege
- Short variant of
npm install some_module
isnpm i some_module
2019 update: Use NVM to install node, not Homebrew
In most of the answers , recommended way to install nvm is to use Homebrew
Do not do that
At Github Page for nvm it is clearly called out:
Homebrew installation is not supported. If you have issues with homebrew-installed nvm, please brew uninstall it, and install it using the instructions below, before filing an issue.
Use the following method instead
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
The script clones the nvm repository to ~/.nvm and adds the source line to your profile (~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc).
And then use nvm to install node. For example to install latest LTS version do:
nvm install v8.11.1
Clean and hassle free. It would mark this as your default node version as well so you should be all set
I'm using n (Node version management)
You can install it in two ways
brew install n
or
npm install -g n
You can switch between different version of node and io. Here's an example from my current env when I call n without params:
$ n
io/3.3.1
node/0.12.7
node/4.0.0
node/5.0.0
ο node/5.10.1