Setting Up Your Development Environment on OS X Machines

Sabrina Thai edited this page Apr 28, 2017 · 1 revision

Installing Cordova and SDKs on OS X

Although most of the instructions needed to install Apache Cordova and SDKs for iOS and Android on an OS X machine are available here, some of the Android installation instructions are difficult to follow and are a bit out of date. Thus, we decided to create our own installation instruction page by adapting some of the instructions provided on this page and this page.

Install Cordova

  1. Install Node.js. Download installer here and run the downloaded installation file.
  2. To test whether the installation was successful, open a terminal window. On a Mac, it will be under Application > Utilities > Terminal. You can also search for Terminal in Spotlight, using the shortcut Cmd + Spacebar. Once Terminal is open, type
    node --version
    If the version number is displayed, your installation was successful.
  3. Install Git. Download the installer here. When you run the downloaded installation file, you may see a warning about how you cannot open it because it is from an unidentified developer or that it cannot be opened because it was not downloaded from the Mac App Store, depending on the settings you have. To circumvent this warning, go to System Preferences > Security and Privacy > General tab. Under the Allow applications downloaded from header, there should an option that allows you to install git.
  4. Install Cordova by going to your Terminal window and typing the following command:
    sudo npm install -g cordova
  5. You can test whether your installation was successful by typing the following command in Terminal:
    cordova --version
    Just like when you installed node, if you see a version number, it means you have successfully installed Apache Cordova.

Install Xcode for iOS development

  1. To access Xcode, you will need to have an Apple ID. If you do not have have one, you can sign up for one for free here.
  2. To actually distribute your app to your participants, however, you will need to sign up for one of the iOS Developer Programs. We recommend the Enterprise program. You can find out more details about the different Apple Developer Programs here. We also discuss the various programs in relation to ExperienceSampler in our manuscript on page 12 and in our online tutorial. We recommend starting this process while you are customizing your app.
  3. Download and install Xcode from this page 4a. When the installation is complete, open Xcode and enable command line tools for Xcode using the following instructions:
  • Go to Xcode > Preferences
  • Select Downloads tab
  • Under Components, locate Command Line Tools and click the download icon
    4b. You can also install Xcode through Terminal by running the following commands:
    xcode -select --install
    Next install the deployment tools, which let you test your iOS apps on iOS devices from the command-line
    npm install -g ios-deploy
  1. To check whether Xcode has been successful installed, go to Terminal and type the following code:
    which g++
    If the next line says usr/bin/g++, then you have successfully installed Xcode.

Install the Android SDK

To develop Android apps, you will need to install Java, the Ant build tool, and the Android SDK

Install Java

  1. First, check whether Java is already installed on your Mac. Go to Terminal and type
    javac - version
    If you see a version number at or above 1.6, you should be good to go.
  2. If Java is not installed, download the Java Installer here. Select the latest version that is compatible with your OS version.

Install Ant

To install Ant, you will need to install Homebrew

  1. First, check whether you have Ant installed, by typing the following command in Terminal
    ant -version
    If you see a version number, Ant is already installed.
  2. Then check whether you have Homebrew installed:
    brew --version
    If you see a version number, Homebrew is already installed.
  3. If you have Homebrew installed, but not Ant, you can install Ant from Terminal using the following command:
    brew update
    brew install ant
  4. If neither Homebrew nor Ant is installed, you can install both with the following command in Terminal:
    ruby -e "$(curl -fsSL"
    brew install ant
  5. Once installation is complete, check that the installation has been successful:
    ant -version

Install Android Development Tools (ADT)

There are several ways to install the Android Development Tools.

The easiest way is to simply install using Homebrew; however, we do not currently recommend this method because the latest version of the Android SDK has deprecated a key command, and we have not yet figured out how to implement the new command. Thus, we currently recommend using the Manual Method.

Manual Installation of ADTs

  1. Download an Android SDK that was released before March 2017. To determine what version you should download, see the release notes. We recommend installing version 25.2.5 at this time. You can download this version of the Android SDK here
  2. Unzip the file. Then go to Application and create a folder named Android-Development. Be sure to include the dash between Android and Development. Inside your Android-Development folder, create a folder named sdk. Drag and drop your unzipped tools folder into the Application > Android-Development > sdk folder.
  3. Now you have to tell your computer where your Android Tools are located by updating your .bash_profile. First, check whether you have a .bash_profile already created. First change your directory to your home directory by typing the following commands into Terminal:
    cd ~/
    open .bash_profile
  4. If a file opens in TextEdit then you can skip this step. Otherwise, you have to create a .bash_profile using the following commands:
    touch .bash_profile
    open .bash_profile
  5. Type the following lines in your .bash_profile:
    export ANDROID_HOME=/Applications/Android-Development/sdk
    export PATH=$PATH:$ANDROID_HOME/tools
  6. Save the file and close it.
  7. Quit and restart Terminal. Once terminal has restarted, type the following command:
    source ~/.bash_profile If the next line loads a blank line, then you have been successful. Now you can build your Android apps. The first time you use the cordova build command will take a while because you will have to install the Build tools. To install these tools, type the command android update sdk --no-ui --all --filter build-tools-25.0.1,android-25,extra-android-m2repository. This command should install all the additional tools you will need.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.