Fetching contributors…
Cannot retrieve contributors at this time
53 lines (31 sloc) 3.44 KB
title url layout

There are a few basic requirements you'll need prior to installing the PhoneGap CLI:

  • Node.js - a JavaScript runtime to build your JavaScript code
  • git - used in the background by the CLI to download assets. It comes pre-installed on some operating systems. You can check if it's already installed by typing git from the command line.

Install via npm

Run the following command to install the latest version of the PhoneGap CLI:

$ npm install -g phonegap

Installing a Specific Version

You can install a specific version of the PhoneGap CLI via npm by specifying the version number after the @ symbol:

$ npm install -g phonegap@5.1.1
**TIP:** To get a listing of the PhoneGap CLI versions available, you can run `$ npm info phonegap`
If you get an `EACCES` error when running any of the commands here, try prefixing it with `sudo`, such as: `$ sudo npm install -g phonegap`

PhoneGap CLI Use Cases

The PhoneGap CLI can be used for different stages of development and with other tools offered by the PhoneGap team. The multiples use cases are outlined below and will determine any other dependencies that may need to be installed.

1 - Paired with the PhoneGap Developer App

Use the PhoneGap CLI to simply create and serve your PhoneGap apps for the PhoneGap Developer App to consume as shown in the Getting Started Guides.

**TIP:** No additional SDK's are needed other than a browser or the PhoneGap Developer app on your mobile device for previewing your apps. You can use this approach for developing a large part of your apps since the PhoneGap Developer app already includes most common plugins and you can tweak your HTML/JS as needed per platform. Once you're ready to move on to configuring, building and packaging your app outside of the PhoneGap Developer app sandbox however, you'll need to move on to one of the two options below.

2 - Paired with PhoneGap Build

Use the PhoneGap CLI to create and configure your apps locally, then build and package them in the PhoneGap Build cloud service.

NOTE: The remote command is used from the PhoneGap CLI to interface with PhoneGap Build once your project has been configured. The Remote Usage Guide provides the details for this command. For details on how to specifically configure your apps for PhoneGap Build. Check out their docs located here.

3 - Standalone

The PhoneGap CLI can be used to do everything from creating your apps to packaging them for distribution. To build, run and package apps for multiple platforms you'll need to install some additional SDK's and/or tools for the platforms you wish to target. Refer to the Cordova Platform Guides for details on how to proceed for each platform.

**TIP:** If you're developing for iOS on a Mac, you may want to install the [ios-sim]( iOS simulator to emulate easily from the command line rather than going into Xcode.