Skip to content

XcodeGen

Generates the Xcode project from a spec file so the .xcodeproj never has to be committed.

Homebrew formula

What it does

XcodeGen reads a project.yml describing targets, schemes, build settings and dependencies, plus your folder structure, and writes the .xcodeproj from scratch. The generated project is then gitignored.

Why that matters

project.pbxproj is a machine-written file with unstable ordering — it is the single worst merge conflict in iOS development. Generating it means the reviewable artefact is a 40-line YAML file, and two branches that both added files merge cleanly.

Notes

Run xcodegen generate after any file add or rename, and add it to a bootstrap script so contributors do not open a stale project.

Alternative to

AlternativeTypeTrade-off
TuistFreemiumThe same idea with a larger feature set: caching, module graphs, generated tests
Swift Package ManagerBuilt inNo .xcodeproj to generate when the target can be a package
Bazel with rules_appleOpen sourceFor large repositories that need hermetic, cached builds

Install

brew install xcodegen

Links

This post is licensed under CC BY 4.0 by the author.
Last updated on