Make sure you have an up-to-date version of Node.js installed on your system. If you don't have Node.js installed, you can install it from here.
Also, for Mac users, having the latest Xcode version installed on your system brings to you command-line-tools and iOs Simulator, download here.
Open a terminal window (Mac) or a command window (Windows), and install Cordova and Ionic:
$ npm install -g cordova ionic
On a Mac, you may have to use sudo depending on your system configuration:
$ sudo npm install -g cordova ionic
If you already have Cordova and Ionic installed on your computer, make sure you update to the latest version:
$ npm update -g cordova ionic
or
$ sudo npm update -g cordova ionic
Follow the Android and iOS platform guides to install required platform dependencies.
Note: iOS development requires Mac OS X. iOS simulator through the Ionic CLI requires the ios-sim npm package, which can be installed with the command:
$ sudo npm -g install ios-sim
Create an Ionic project using one of the ready-made app templates, or a blank one to start fresh.
$ ionic start myApp blank
or
$ ionic start myApp tabs
or
$ ionic start myApp sidemenu
To test your Ionic app in a desktop browser on both iOS and Android platforms:
$ ionic serve --lab
Whereas ionic serve --lab
is great to test the app UI on multiple platforms it could lead to some problems for Javascript Console or Element Inspection, in that case what you may prefer:
$ ionic serve
To test your Ionic app in an emulator:
$ cd myApp
$ ionic platform add ios android
$ ionic build ios
$ ionic emulate ios
Substitute ios with android for Android emulator testing:
$ ionic build android
$ ionic emulate android
To test your Ionic app in an Android device connected via USB:
$ ionic run android
To test your Ionic app in an iOS device connected via USB:
$ ionic run ios --device