A GitHub Actions composite action that selects a specific Xcode version on macOS runners via xcode-select.
This action is also published on the GitHub Actions Marketplace.
The action resolves the Xcode version using the following priority:
xcode-versioninput — explicit version passed to the action.xcode-versionfile — a file at the root of the repository containing the version stringXCODE_VERSIONenvironment variable — a variable already set in the workflow environment
If none of the above provides a version, the action fails with a descriptive error message.
- uses: LucaTools/select-xcode@main
with:
xcode-version: "26.2"Commit a .xcode-version file to the root of your repository:
26.2
Then use the action without any input:
- uses: LucaTools/select-xcode@mainenv:
XCODE_VERSION: "26.2"
steps:
- uses: LucaTools/select-xcode@main| Name | Required | Default | Description |
|---|---|---|---|
xcode-version |
No | "" |
The version of Xcode to select. |
name: CI
on:
push:
branches: [main]
jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: LucaTools/select-xcode@main
with:
xcode-version: "26.2"
- name: Build
run: xcodebuild build -scheme MyApp- Must run on a macOS runner (e.g.
macos-latest,macos-26). - The requested Xcode version must be available at
/Applications/Xcode_<version>.app.