Deploying Mac executors requires a little extra love since the deployment process can't easily be automated via Kubernetes.
First you'll need to deploy the BuildBuddy app which serves the BuildBuddy UI, acts as a scheduler, and handles caching - which we still recommend deploying to a Linux Kubernetes cluster.
You can follow the standard Enterprise RBE Setup instructions to get your cluster up and running.
Once you have a BuildBuddy cluster deployed with RBE enabled, you can start setting up your Mac executors.
When starting with a clean Mac, you'll first need to make sure XCode is installed. You can download XCode from Apple's Developer Website (you'll need an Apple Developer account).
We recommend installing at least XCode 12.2 (which is the default XCode version used if no
--xcode_version Bazel flag is specified).
If installing on many machines, we recommend downloading the XCode .xip file to a location you control (like a cloud storage bucket) and downloading from there using a simple curl command. This reduces the number of times you have to login to your Apple Developer account.
Once your .xip file is downloaded, you can expand it with the following command.
You can then move it to your
Applications directory with the version number as a suffix (so multiple XCode versions can be installed together and selected between using the
--xcode_version Bazel flag).
If this is the first XCode version you're installing, you'll want to select it as your default XCode version with:
You can then accept the license with:
And run the "first launch" with
You'll likely want to install Homebrew on your fresh executor to make installing other software easier. You can install it with the following line:
Now that the environment is configured, we can download and install the BuildBuddy Mac executor.
The latest BuildBuddy executor binary can be downloaded with:
In order to run the executor binary, we must first make it executable with:
If you don't already have any launch agents installed, you'll need to make sure the
~/Library/LaunchAgents/ directory exits with:
You'll also need a directory to store the executor's disk cache and execution roots. We recommend avoiding using the
/tmp directory since this is periodically cleaned up.
You'll need to create a
config.yaml with the following contents:
Make sure to replace YOUR_USERNAME with your Mac username and YOUR_BUILDBUDDY_CLUSTER_URL with the grpc url the BuildBuddy cluster you deployed. If you deployed the cluster without an NGINX Ingress, you'll need to update the protocol to grpc:// and the port to 1985.
Now that everything is in place, we can create a LaunchAgent .plist file that tells Mac OS to keep the executor binary running on launch, and restart it if ever stops.
Make sure to replace YOUR_USERNAME with your Mac username and YOUR_MACS_NETWORK_ADDRESS with the IP address or DNS name of the Mac.
You can place this file in
You may need to update the file's permissions with:
You can load the Launch Agent with:
And start it with:
You can verify that your BuildBuddy Executor successfully connected to the cluster by live tailing the stdout file:
If your Mac executor restarts for whatever reason, you'll likely want to enable auto login so the executor will reconnect after rebooting instead of getting stuck on a login screen.
There's a convenient
brew package called
kcpassword that makes this easy.
If you're doing a lot of Java builds on your Mac executors that are not fully hermetic (i.e. rely on the system installed Java rather than the remote Java SDK shipped by Bazel), you can install the JDK with: