A quick guide to installing and beginning to develop with Apache Cordova on Mac.

  1. Download Phonegap
  2. Unzip the archive. Move the folder to a permanent location.
  3. Open the folder, go to the lib folder, go to iOS folder, go to the bin folder.
  4. Open up a Terminal window.
  5. Drag the create executable into the Terminal window. Type in the location of where you would like your project created. Type in the identifier for your project (ex. com.christophersu.project). Type in the name of your project. Hit enter. Example of what this should look like: Christopher-Su:~ christophersu$ /Users/christophersu/Code/phonegap/lib/ios/bin/create ~/Code/ExampleProject com.christophersu.ExampleProject ExampleProject
  6. Type in cd followed by the path to your project (ex. Christopher-Su:~ christophersu$ cd ~/Code/ExampleProject)
  7. Type in cordova/debug to run the debug executable and build your project.
  8. To emulate or simulate your project from the command line, run the cordova/emulate executable. Note that this requires ios-sim to be installed (see below).

If you get an error telling you to install ios-sim when running the emulate executable, this is the fastest way to install ios-sim:

  1. Run ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)" in Terminal. This installs Homebrew.
  2. Run brew install ios-sim. Wait for it to complete.

That’s it! Output should look like this:

Christopher-Su:~ christophersu$ brew install ios-sim
==> Downloading https://github.com/phonegap/ios-sim/tarball/1.5
######################################################################## 100.0%
==> rake install prefix=/usr/local/Cellar/ios-sim/1.5
/usr/local/Cellar/ios-sim/1.5: 4 files, 76K, built in 10 seconds
Christopher-Su:~ christophersu$