Part 1: Installing Cordova

First, installing:

To install PhoneGap you should first install the Node.js framework (npm) since that will enable you to install Cordova (the Apache project that enables embedding Web applications within native applications of mobile platforms such as Android, iOS etc.)

So, to install Node.js you just type

For OS/X, I suggest installing the homebrew package manager from here and then: brew install npm

For Linux (or rather Ubuntu 12.04) the obvious path was to run sudo apt-get install npm
however, the version of npm installed caused problems further down the road (for example getting an ECONNREFUSED when attempting to add a plugin). My advice for Ubuntu 12.04 then is to try one of two things:

# Save as ~/npm_install.sh, chmod u+x and run it. It will take a long while to complete...# The install script# Adapted from https://gist.github.com/579814echo' '>> ~/.bashrc
echo'# Added by install script for node.js and npm'>> ~/.bashrc
echo'export PATH=$HOME/local/bin:$PATH'>> ~/.bashrc
echo'export NODE_PATH=$HOME/local/lib/node_modules'>> ~/.bashrc
. ~/.bashrc
mkdir-p ~/localmkdir-p ~/Downloads/node-latest-install
cd ~/Downloads/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz |tar xz --strip-components=1
./configure --prefix=~/local# if SSL support is not required, use --without-sslmakeinstall

Ok, now that we have npm installed, lets use it to install Cordova. Cordova is the engine that powers PhoneGap.

So we install Cordova:
On both Ubuntu and OS/X it’s just a matter of: sudo npm install -g cordova

Now, having Cordova installed, you’ll need to download the Android SDK to embed Web applications as Android applications with Cordova, and you’ll need to have Xcode to embed your Web applications in iOS, but after that, you can start using Cordova command line just installed to compile your web application to a mobile phone application.

After this you’ll have access to cordova via the command line.
Using cordova to build and run your apps will be discussed in the next posts.