How do I automatically stop a build after a set time (e.g., 30 minutes)?
Last updated: June 26, 2026
Context
You may want your builds to end automatically after a certain amount of time so they don’t run until the maximum build duration. For example, instead of waiting for 2 hours, you might prefer they stop after 30 minutes. This can be configured directly in your workflow settings.
Answer
Use the max_build_duration setting in your workflow configuration to automatically timeout a build once it reaches the specified build duration.
Open your workflow in codemagic.yaml
Add or update the setting:
max_build_duration: 30Replace 30 with the number of minutes you want (maximum allowed is 120, except for Enterprises).
Save and run your workflow. Any build that exceeds this duration will stop automatically.