explaingit

yonaskolb/xcodegen

8,423SwiftAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

XcodeGen generates Xcode project files from a simple YAML config so iOS and macOS teams can stop committing the notoriously merge-conflict-prone .xcodeproj file to version control.

Mindmap

mindmap
  root((xcodegen))
    What it does
      Generate Xcode project
      From YAML spec
      Eliminates merge conflicts
    Spec Contents
      Targets and sources
      Build settings
      Dependencies
      Schemes
    Dependencies Supported
      Swift packages
      Carthage
      Vendored frameworks
    Installation
      Homebrew
      Mint
      Swift Package Manager
    CI Benefits
      Cache flag
      Skip unchanged regen
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Replace your committed Xcode project file with a YAML spec so adding a source file no longer creates merge conflicts for the whole team.

USE CASE 2

Auto-generate multiple schemes (staging, production, release) from your XcodeGen spec without manually creating them in Xcode.

USE CASE 3

Share build settings across app and framework targets using setting groups to eliminate repetition in your project spec.

USE CASE 4

Speed up CI builds with the XcodeGen cache flag, which skips regeneration when the spec and file system haven't changed.

Tech stack

SwiftSwift Package ManagerYAML

Getting it running

Difficulty · easy Time to first run · 30min

Requires Homebrew or Mint for installation, existing projects need their .xcodeproj recreated from a spec, which takes some initial setup time.

Use, copy, modify, and distribute freely for any purpose, including commercial, as long as you keep the copyright notice.

In plain English

XcodeGen is a command-line tool for iOS and macOS developers that generates Xcode project files from a human-readable configuration file. Xcode project files (the .xcodeproj package) are notoriously painful in team settings because they change every time a developer adds a file or tweaks a setting, and those changes create merge conflicts when multiple people work on the same codebase. XcodeGen sidesteps this by letting teams store a simple YAML or JSON spec in version control instead of the generated project file. The spec describes the targets in your project (apps, frameworks, test targets), their deployment targets, source folders, build settings, dependencies, and schemes. When you run the tool, it reads that spec and your folder structure and produces a fresh .xcodeproj. You can regenerate the project at any time, and because the tool reads your file system directly, the groups and files shown in Xcode always match what is actually on disk. Adding a new file to a folder is enough, you do not need to also add it in Xcode. Build settings can be shared across multiple targets using setting groups, which cuts down on repetition. Dependencies on other targets, Carthage frameworks, vendored frameworks, and Swift packages are all declared in the spec. Schemes for different environments, such as staging and production, can also be auto-generated. XcodeGen is installed most simply via Homebrew with a single brew install command, or via the Mint package manager for Swift CLI tools. It can also be built from source using the Swift Package Manager. A cache flag lets you skip regeneration when the spec and file system have not changed since the last run, which keeps CI builds fast. The project is MIT-licensed.

Copy-paste prompts

Prompt 1
Write a minimal XcodeGen project.yml that defines an iOS app target called MyApp with deployment target iOS 16, a source folder of Sources/MyApp, and a test target.
Prompt 2
I have a monorepo with an app and two Swift Package dependencies. Show me the XcodeGen spec syntax to declare those package dependencies in the app target.
Prompt 3
Explain what happens when I add a new Swift file to the Sources folder and then run xcodegen, do I need to do anything in Xcode after that?
Prompt 4
Generate an XcodeGen spec that creates three schemes: Debug, Staging, and Production, each with a different bundle identifier and a different build configuration.
Prompt 5
How do I migrate an existing Xcode project to XcodeGen, what's the safest step-by-step process to avoid breaking the build?
Open on GitHub → Explain another repo

← yonaskolb on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.