Skip to content
Latchkey

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.

swift
error: package at '.' is using Swift tools version 6.0.0 but the installed swift-tools-version is 5.9.0

Common 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

  1. Read the required tools version from the error.
  2. Point xcode-select at an Xcode that ships that Swift, or install the toolchain.
  3. Verify with swift --version before building.
.github/workflows/ci.yml
- run: sudo xcode-select -s /Applications/Xcode_16.app
- run: swift --version
- run: swift build

Lower 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.

Package.swift
// swift-tools-version:5.9

How to prevent it

  • Keep the runner Xcode/Swift aligned with the highest tools version in your graph.
  • Pin xcode-select to a known Xcode instead of relying on the image default.
  • Review dependency updates that bump swift-tools-version.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →