How do I enable Xcode compilation caching for a Flutter iOS build on Codemagic?

Last updated: June 26, 2026

Context

When building a Flutter iOS app on Codemagic, you may want to take advantage of Xcode compilation caching to speed up your builds. While Codemagic supports Xcode compilation caching, it is not immediately obvious how to configure it within a Flutter workflow, since the caching only applies to the native iOS compilation portion of the build.

Answer

You can enable Xcode compilation caching for a Flutter iOS build by following these two steps in your Codemagic workflow configuration:

  1. Enable compilation caching in the build step

    Export the COMPILATION_CACHE_ENABLE_CACHING environment variable before running the Flutter build command:

    scripts:
      - name: Build iOS
        script: |
          export COMPILATION_CACHE_ENABLE_CACHING=YES
          flutter build ipa
  2. Cache the Xcode compilation cache directory

    Add the Xcode compilation cache directory to your workflow's cache paths so the cache is preserved and reused between builds:

    cache:
      cache_paths:
        - ~/Library/Developer/Xcode/DerivedData/CompilationCache.noindex

Note that this caching only applies to the native iOS compilation part of the build, not the Dart/Flutter compilation steps.

For more general information on caching in Codemagic, refer to the Codemagic Caching documentation.