Start Building for Free

Machine runner installation on macOS

1 month ago2 min read
Server v4.x
Server v3.x
On This Page

This page describes how to install CircleCI’s machine runner on macOS.

Download the macOS launch-agent script

Save the script file to an easily accessible location. From that location, install the launch-agent binary for your target platform, either x86_64, or M1 (Apple silicon):

# For macOS x86_64:
export platform=darwin/amd64 && sh ./

# For macOS M1:
export platform=darwin/arm64 && sh ./

After successful installation, the file can be deleted.

Create a CircleCI’s self-hosted runner configuration

You will need to choose a user to run the CircleCI agent. These instructions refer to the selected user as USERNAME. The USERNAME refers to the user on the machine that the agent will be installed on, not the CircleCI account username.

Complete the template shown below, with the various capitalized parameters filled in. When complete, save the template as launch-agent-config.yaml.

  auth_token: AUTH_TOKEN
  # On server, set url to the hostname of your server installation. For example,
  # url:

  command_prefix : ["sudo", "-niHu", "USERNAME", "--"]
  working_directory: /var/opt/circleci/workdir
  cleanup_working_directory: true

  file: /Library/Logs/com.circleci.runner.log
  • Replace AUTH_TOKEN with the resource class token created in the set up process.

  • Replace RUNNER_NAME with the name you would like for your self-hosted runner. RUNNER_NAME is unique to the machine that is installing the runner. RUNNER_NAME can be any value you would like, and it does not need to include any part of your namespace or resource class name. However, it is recommended to use the hostname of the machine so that it can be used to identify the agent when viewing statuses and job results in the CircleCI web app. The only special characters accepted in RUNNER_NAME are . () - _.

Update the Working Directory Permission

The CircleCI agent requires write permission to the directory containing the working directory. Change the ownership of that directory to USERNAME:

sudo chown USERNAME /var/opt/circleci

Install the CircleCI’s self-hosted runner configuration

Create a directory as root to hold the CircleCI’s self-hosted runner configuration:

sudo mkdir -p '/Library/Preferences/com.circleci.runner'

Copy the previously created launch-agent-config.yaml into the directory and change its permissions to 600:

sudo cp "launch-agent-config.yaml" "/Library/Preferences/com.circleci.runner/launch-agent-config.yaml"
sudo chmod 600 "/Library/Preferences/com.circleci.runner/launch-agent-config.yaml"

Create and install the launchd .plist

Create a com.circleci.runner.plist file with a path of /Library/LaunchDaemons/com.circleci.runner.plist, owned by root, with permissions 644. Use the following commands:

sudo touch /Library/LaunchDaemons/com.circleci.runner.plist
sudo chown root: /Library/LaunchDaemons/com.circleci.runner.plist
sudo chmod 644 /Library/LaunchDaemons/com.circleci.runner.plist

Copy the following to the new /Library/LaunchDaemons/com.circleci.runner.plist file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
<plist version="1.0">




        <!-- The agent needs to run at all times -->

        <!-- This prevents macOS from limiting the resource usage of the agent -->

        <!-- Increase the frequency of restarting the agent on failure, or post-update -->

        <!-- Wait for 10 minutes for the agent to shut down (the agent itself waits for tasks to complete) -->

        <!-- The agent uses its own logging and rotation to file -->

Machine runner configuration example

The fields you must set for a specific job to run using your self-hosted runners are:

  • machine: true

  • resource_class: <namespace>/<resource-class>

Simple example of how you could set up a job:

version: 2.1

      - runner
    machine: true
    resource_class: <namespace>/<resource-class>
      - run: echo "Hi I'm on Runners!"

Enable the launchd service

Now you can load the service:

sudo launchctl load '/Library/LaunchDaemons/com.circleci.runner.plist'
sudo launchctl unload '/Library/LaunchDaemons/com.circleci.runner.plist'

Verify the service is running

Open the pre-installed macOS application Console. In this application, you can view the logs for the CircleCI agent under Log Reports. Look for the logs called com.circleci.runner.log in the list. You can also find this file by navigating to Library > Logs.


Refer to the Troubleshoot Machine Runner section of the Troubleshoot Self-hosted Runner guide if you encounter issues installing or running machine runner on macOS.

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.

Need support?

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.