首先要安装brew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

安装nodejs
brew install node

安装Cordova和Ionic
npm install -g cordova ionic