Skip to main content

Optimizing Build Performance on CircleCI's macOS Executors

Overview

This support article provides guidance on optimizing build performance for macOS executors on CircleCI. It addresses two main issues: caching and resource constraints. By implementing the suggested solutions, users can improve build times and leverage available resources efficiently.

Issue 1: Caching

One potential cause for longer build times is outdated caching, where builds with code changes take longer due to an outdated cache. CircleCI offers two options to mitigate this issue:

1. Utilize Multiple Caches with Environment Variables

Users can use environment variables to create multiple caches, ensuring that builds can pull a specific cache that closely matches the build it was created by. This approach helps mitigate the effects of certain changes or other factors that slow down builds.

2. CircleCI's Caching Method

CircleCI provides its own caching method, which can be used to optimize build times. However, it's important to note that CircleCI caches are purged after 15 days. If longer cache storage is required, it is recommended to vote on and comment on the following feature suggestion:

Issue 2: Resource Constraints

The second issue impacting build performance is the resource constraints of macOS executors on CircleCI compared to local machines. Local machines can utilize 100% of available resources, which are often more plentiful than those provided by CircleCI's resource class. To address this, consider the following options:

Upgrade Your Resource Class

Upgrade to a higher resource class, ideally on an M1 machine, which can provide access to more resources for faster builds. Refer to the [CircleCI Configuration Reference](https://circleci.com/docs/configuration-reference/#macos-execution-environment) for more information on upgrading resource classes.

Migrate to Machine Runner on MacOS

Explore migrating your builds to CircleCI Machine Runner, which allows you to use your local hardware for running builds. This approach provides greater control over resources and can potentially improve build performance.

Please note that CircleCI is likely tophase out support for Intel-based CPU architectures in the future, so considering M1 machines would be beneficial in the long run.

Alternatively, self-hosted runners could be a more viable option if you have the necessary hardware available.

By following these recommendations and leveraging the available options, you can optimize build performance on CircleCI's macOS executors, ensuring faster and more efficient builds for your projects.

Additional Resources

Refer to the following documentation for more details on Runner Overview and Runner Installation for macOS.

If you require further assistance or have specific questions, please don't hesitate to reach out to our support team.

Did this answer your question?