SwiftPM "swift-tools-version" mismatch in Package.swift in CI
The // swift-tools-version line at the top of Package.swift declares the minimum SwiftPM version needed to interpret it. If the runner Swift is older, SwiftPM will not load the package.
What this error means
swift build fails with "package at '.' is using Swift tools version X.Y but the installed swift-tools only supports up to A.B" or a similar minimum-tools-version message.
error: package at '.' is using Swift tools version 6.0.0 but the installed swift-tools-version is 5.9.0Common causes
The runner Swift is older than the manifest requires
The manifest declares // swift-tools-version:6.0 but the runner image ships an older Swift/Xcode, so SwiftPM cannot interpret the newer manifest format.
A dependency raised its tools version
A transitive package bumped its own swift-tools-version past the runner toolchain, and it now cannot be loaded during resolution.
How to fix it
Select a matching Swift toolchain on the runner
- Read the required tools version from the error.
- Point
xcode-selectat an Xcode that ships that Swift, or install the toolchain. - Verify with
swift --versionbefore building.
- run: sudo xcode-select -s /Applications/Xcode_16.app
- run: swift --version
- run: swift buildLower the manifest tools version if you can
If you do not need newer manifest features, set the tools version to one your CI toolchain supports.
// swift-tools-version:5.9How to prevent it
- Keep the runner Xcode/Swift aligned with the highest tools version in your graph.
- Pin
xcode-selectto a known Xcode instead of relying on the image default. - Review dependency updates that bump swift-tools-version.