license: > Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.

title: OS X Platform Guide toc_title: OS X

OS X Platform Guide

This guide shows how to set up your SDK development environment to deploy Cordova apps for OS X computers. See the following for more detailed platform-specific information:

The command-line tools above refer to versions prior to Cordova 3.0. See The Command-Line Interface for information about the current interface.

Requirements and Support

Apple® tools required to build OS X applications run only on the OS X operating system on Intel-based Macs. Xcode® 6.0 (the minimum required version) runs only on OS X version 10.9 (Mavericks) or greater, and includes the OS X SDK (Software Development Kit). To submit apps to the Apple App Store℠ requires the latest versions of the Apple tools.

You can test all of the Cordova features using the XCode or any other IDE such as JetBrain's AppCode, but you need to use XCode to sign before submitting to the App Store. To sign the apps, you must also be a member of Apple's OS X Developer Program.

Install the SDK

There are two ways to download Xcode:

  • from the App Store, available by searching for “Xcode” in the App Store application.

  • from Apple Developer Downloads, which requires registration as an Apple Developer.

Once Xcode is installed, several command-line tools need to be enabled for Cordova to run. From the Xcode menu, select Preferences, then the Downloads tab. From the Components panel, press the Install button next to the Command Line Tools listing.

Create a New Project

Use the cordova utility to set up a new project, as described in The Cordova The Command-Line Interface. For example, in a source-code directory:

$ cordova create hello com.example.hello "HelloWorld"
$ cd hello
$ cordova platform add osx
$ cordova prepare              # or "cordova build"

Run the app

To run the app on your desktop:

$ cordova run

And you should see a bordered window with the example app:

![]({{ site.baseurl }}/static/img/guide/platforms/osx/helloworld_run.png)

You can also use cordova run --help to see additional build and run options.

Open a Project in the SDK

Once osx platform is added to your project, you can open it from within Xcode. Double-click to open the hello/platforms/osx/HelloWorld.xcodeproj file. The screen should look like this:

![]({{ site.baseurl }}/static/img/guide/platforms/osx/xcode10-review-project.png)

TIP You can also use the open command to open the XCode project directly from the command line:

$ open platforms/osx/HelloWorld.xcodeproj

Common Problems

Deprecation Warnings: When an application programming interface (API) is changed or replaced by another API, it is marked as deprecated. The API still works in the near term, but is eventually removed. Some of these deprecated interfaces are reflected in Apache Cordova, and Xcode issues warnings about them when you build and deploy an application.

Missing Headers: Compilation errors relating to missing headers result from problems with the build location, and can be fixed via Xcode preferences:

  1. Select Xcode → Preferences → Locations.

  2. In the Derived Data section, press the Advanced button and select Unique as the Build Location as shown here:

    ![]({{ site.baseurl }}/static/img/guide/platforms/osx/xcode10-build-location.png)

This is the default setting for a new Xcode install, but it may be set differently following an upgrade from an older version of Xcode.

For further information, consult Apple's documentation:

(Mac®, OS X®, Apple®, Xcode®, App Store℠, iPad®, iPhone®, iPod® and Finder® are Trademarks of Apple Inc.)