Configuring a macOS application on CircleCI
On This Page
This document describes how to get started with CI/CD using a macOS execution environment on CircleCI. If you need to learn the basics of CircleCI, see the getting started guide. You may also want to visit the documentation for testing and setting up iOS projects.
To follow along with this document you will need:
- An account on CircleCI.
- An Apple computer with XCode installed on it (if you want to open the example project).
Overview of the macOS executor
The macOS execution environment is used for iOS and macOS development, allowing you to test, build, and deploy macOS and iOS applications on CircleCI. The macOS executor runs jobs in a macOS environment and provides access to iPhone, iPad, Apple Watch and Apple TV simulators.
Before we get to setting up the macOS executor, we will need to setup our example application.
The example application is a simple mac app. The app runs a 5 minute timer and contains a single unit test. Real-world applications will be far more complex. This app simply serves as an introduction to the macOS execution environment.
In this example app, CircleCI is configured to help with the following:
- Run tests using XCode on the macOS virtual machine whenever we push a change to the repository.
- Create and upload the compiled application as an artifact after tests have run successfully.
You can check out the example application’s repo on GitHub.
Please note, if you would like to test running the code in the example configuration file (below) yourself, you should either fork, or duplicate the example application from GitHub. The example configuration file is not guaranteed to work on any/all Xcode projects.
Example configuration file
Our application does not make use of any external tools or dependencies, so we have a fairly simple
.circleci/config.yml file. Below, each line is commented to indicate what is happening at each step.
For a full list of supported Xcode versions, see the using macOS page.
version: 2.1 jobs: # a basic unit of work in a run test: # your job name macos: xcode: 14.1.0 # indicate our selected version of Xcode steps: # a series of commands to run - checkout # pull down code from your version control system. - run: name: Run Unit Tests command: xcodebuild test -scheme circleci-demo-macos build: macos: xcode: 14.1.0 # indicate our selected version of Xcode steps: - checkout - run: # build our application name: Build Application command: xcodebuild - run: # compress Xcode's build output so that it can be stored as an artifact name: Compress app for storage command: zip -r app.zip build/Release/circleci-demo-macos.app - store_artifacts: # store this build output. Read more: https://circleci.com/docs/2.0/artifacts/ path: app.zip destination: app workflows: test_build: jobs: - test - build: requires: - test
.circleci/config.yml above covers the following:
- Specify an
- Pull code using the
- Run tests with Xcode
- Build the application
- Compress the application and store it using the
You can learn more about the
.circleci/config.yml file in the Configuration Reference.
The macOS executor is commonly used for testing and building iOS applications, which can be more complex in their continuous integration configuration. If you are interested in building and/or testing iOS applications, consider checking out our following docs that further explore this topic:
Help make this document better
This guide, as well as the rest of our docs, are open source and available on GitHub. We welcome your contributions.
- Suggest an edit to this page (please read the contributing guidefirst).
- To report a problem in the documentation, or to submit feedback and comments, please open an issue on GitHub.
- CircleCI is always seeking ways to improve your experience with our platform. If you would like to share feedback, please join our research community.
Our support engineers are available to help with service issues, billing, or account related questions, and can help troubleshoot build configurations. Contact our support engineers by opening a ticket.
You can also visit our support site to find support articles, community forums, and training resources.
CircleCI Documentation by CircleCI is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.