Install machine runner 3.0 on macOS
On This Page
- Prerequisites
- Self-hosted runner terms agreement
- 1. Create namespace and resource class
- 2. Install CircleCI runner on macOS
- Migrate existing configuration files
- 3. Review and accept the Apple signature notarization
- 4. Start macOS machine runner 3.0
- 5. Stop macOS machine runner 3.0
- Uninstall machine runner 3.0 on macOS
- Access runner logs
- Machine runner configuration example
- Additional resources
This page describes how to install CircleCI’s machine runner 3.0 on macOS.
Prerequisites
To install machine runners and run jobs, you will need to have root access, and have the following utilities and tools installed on your system:
-
coreutils (Linux only)
-
curl (installed by default on macOS)
-
sha256sum (if not pre-installed):
-
brew install coreutils
for macOS (requires Homebrew) -
sudo apt install coreutils
for Ubuntu/Debain -
sudo yum install coreutils
for Red Hat
-
-
sepolicy ( RHEL 8 only)
-
rpmbuild ( RHEL 8 only)
-
The CircleCI CLI if you wish to install runners from the command line
Self-hosted runner terms agreement
1. Create namespace and resource class
If you are installing self-hosted runners for server, the CircleCI CLI needs to be configured using your server API key. Run circleci setup to configure the CLI and access the option to supply a new API token if required. |
In order to install self-hosted runners, you will need to create a namespace and authentication token by performing the steps listed below. Please note that to create resource classes and tokens you need to be an organization administrator in the VCS provider.
You can view your installed runners on the inventory page in the web app, by clicking Self-Hosted Runners on the left navigation.
-
Create a namespace for your organization’s self-hosted runners. Each organization can only create a single namespace. We suggest using a lowercase representation of your CircleCI organization’s account name. If you already use orbs, this namespace should be the same namespace orbs use.
Use the following command to create a namespace:
circleci namespace create <name> --org-id <your-organization-id>
If your organization already has a namespace, you will receive an error if you run the above command to create a different namespace. The error message returns the name of the existing namespace. In this case, move on to step 2 below, using your existing namespace. -
Create a resource class for your self-hosted runner’s namespace using the following command:
circleci runner resource-class create <namespace>/<resource-class> <description> --generate-token
Make sure to replace
<namespace>
and<resource-class>
with your org namespace and desired resource class name, respectively. You may optionally add a description.Example:
circleci runner resource-class create my-namespace/my-resource-class my-description --generate-token
.The resource class token is returned after the runner resource class is successfully created.
The token cannot be retrieved again, so be sure to store it safely.
2. Install CircleCI runner on macOS
You can install runner on macOS with Homebrew.
-
On the target macOS machine with Homebrew installed, run the following command to add the CircleCI repository:
brew tap circleci-public/circleci
-
Run the following command to install the
circleci-runner
package:You may see a notification indicating a background item for Circle Internet Services Inc. has been added. brew install circleci-runner
-
Open the runner
config.yaml
file with the text editor of your choice, and modify theand
template values.
nano $HOME/Library/Preferences/com.circleci.runner/config.yaml
runner: name: "my-macos-runner" working_directory: "/Users/$USER/Library/com.circleci.runner/workdir" cleanup_working_directory: true api: auth_token: "your-auth-token"
-
Replace
with the token generated in the steps above, and choose a name for your runner.
Migrate existing configuration files
If you are migrating an existing configuration from a previous runner installation, you may move the existing launch agent file from its current path to the new path.
this will overwrite the default config file installed via brew and replace it with your existing config file. |
mv /Library/Preferences/com.circleci.runner/launch-agent-config.yaml $HOME/Library/Preferences/com.circleci.runner/config.yaml
After copying the file, you may remove the logging block to send logs to the default location for machine runner 3.0 (specified below):
# remove this block from your existing config
logging:
file: /Library/Logs/com.circleci.runner.log
3. Review and accept the Apple signature notarization
The binary must be approved to run on your macOS system because the self-hosted runner is not compiled from source during installation. This can be done via the macOS UI by accepting the pop-up asking if you wish to run the binary from the internet, or programmatically.
-
Verify the signature and notarization with this command:
spctl -a -vvv -t install "$(brew --prefix)/bin/circleci-runner"
It should return an output that looks like this:
/opt/homebrew/bin/circleci-runner: accepted source=Notarized Developer ID origin=Developer ID Application: Circle Internet Services Inc.
-
When ready, run the command to accept the notarization. You will need to enter the macOS system password.
sudo xattr -r -d com.apple.quarantine "$(brew --prefix)/bin/circleci-runner"
4. Start macOS machine runner 3.0
To start the macOS machine runner 3.0 for the first time, run the following commands to bootstrap and load the plist
file:
launchctl bootstrap gui/`stat -f %u` $HOME/Library/LaunchAgents/com.circleci.runner.plist
launchctl load $HOME/Library/LaunchAgents/com.circleci.runner.plist
5. Stop macOS machine runner 3.0
To stop the machine runner service, run the following command to unload the plist
file:
launchctl unload $HOME/Library/LaunchAgents/com.circleci.runner.plist
Uninstall machine runner 3.0 on macOS
To uninstall machine runner from your macOS device, follow these steps.
-
Stop the machine runner service by using the following command to unload the
plist
file:launchctl unload $HOME/Library/LaunchAgents/com.circleci.runner.plist
-
Uninstall machine runner:
Access runner logs
On your macOS machine, logs from circleci-runner
are located in the following directory by default.
$HOME/Library/Logs/com.circleci.runner/runner.log
Machine runner configuration example
The fields you must set for a specific job to run using your machine runners are:
-
machine: true
-
resource_class: <namespace>/<resource-class>
Simple example of how you could set up a job:
version: 2.1
workflows:
build-workflow:
jobs:
- runner
jobs:
runner:
machine: true
resource_class: <namespace>/<resource-class>
steps:
- run: echo "Hi I'm on Runners!"
The job will then execute using your self-hosted runner when you push the .circleci/config.yml
to your VCS provider.
Additional resources
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 guide first).
- 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.
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.
CircleCI Documentation by CircleCI is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.