Skip to content
Latchkey

How to Select an Xcode Version in GitHub Actions

macOS runners ship several Xcode versions; point xcode-select (or setup-xcode) at the exact one your build needs.

GitHub macOS images preinstall multiple Xcodes under /Applications/Xcode_<version>.app. Activate one with sudo xcode-select -s, or let maxim-lobanov/setup-xcode resolve a version range for you.

Steps

  • List installed Xcodes with ls /Applications | grep Xcode.
  • Switch the active toolchain with sudo xcode-select -s /Applications/Xcode_<ver>.app.
  • Or add maxim-lobanov/setup-xcode with an xcode-version to resolve it for you.
  • Verify with xcodebuild -version.

Workflow

.github/workflows/ci.yml
jobs:
  build:
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v4
      - uses: maxim-lobanov/setup-xcode@v1
        with:
          xcode-version: '16.2'
      - run: xcodebuild -version

Plain xcode-select alternative

.github/workflows/ci.yml
steps:
  - run: sudo xcode-select -s /Applications/Xcode_16.2.app
  - run: xcodebuild -version && swift --version

Gotchas

  • A version present on one runner image may not exist on another; check the image release notes before pinning.
  • Use xcode-version: latest-stable with setup-xcode to track the newest GA release automatically.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →