Early Xcode 26 betas can fail to compile Swift packages that contain macros, with diagnostics centered on _SwiftSyntaxCShims. Apple documented this as a known issue in the prebuilt Swift Syntax support for macros and marked it resolved in Xcode 26 Beta 4.
Representative error
error: redefinition of module '_SwiftSyntaxCShims'
error: could not build module '_SwiftSyntaxCShims'
Command SwiftCompile failed with a nonzero exit code
The surrounding lines vary with the package and destination, but Apple’s release notes identify a build failure around _SwiftSyntaxCShims as the common symptom.
Cause
The failure comes from the prebuilt swift-syntax integration introduced for Swift macro builds in early Xcode 26 betas. During package dependency resolution, the internal _SwiftSyntaxCShims module can be provided in a conflicting way. This does not necessarily indicate a syntax error in your macro or application code.
Affected configurations and versions
- Xcode 26 Beta 1 through Beta 3
- A Swift Package Manager dependency that contains Swift macros or depends on
swift-syntax - The failure persists after a clean build or package re-resolution and points to
_SwiftSyntaxCShims
Apple lists issue 152253497 under the resolved issues for Xcode 26 Beta 4. Use Xcode 26 Beta 4 or later, preferably the latest stable Xcode 26 release.
Recommended fix
- Check the installed build in About Xcode.
- Update to Xcode 26 Beta 4 or later, preferably the latest stable Xcode.
- Quit Xcode and remove the affected project’s Derived Data.
- Resolve package dependencies again, then rebuild.
rm -rf ~/Library/Developer/Xcode/DerivedData/*
On a shared development machine, avoid deleting every project’s cache. Use Xcode Settings > Locations and remove only the affected project’s Derived Data directory.
Apple’s workaround when you cannot update
Apple recommends disabling the Swift Syntax prebuilt feature for macros, clearing Derived Data, restarting Xcode, and building again.
defaults write com.apple.dt.Xcode IDEPackageEnablePrebuilts NO
rm -rf ~/Library/Developer/Xcode/DerivedData/*
After moving to a fixed Xcode version, remove the override to restore the default behavior:
defaults delete com.apple.dt.Xcode IDEPackageEnablePrebuilts
Alternatives
- Move CI to an image containing a fixed Xcode release.
- Temporarily pin a dependency version that does not include the macro, after checking API compatibility.
- Remember that the
defaultsoverride is per user; configure it explicitly for CI or another macOS account.
How to verify the fix
- Run
xcodebuild -versionand confirm Xcode 26 Beta 4 or later. - Resolve packages, clean the build folder, and build the same scheme again.
- Confirm that the log no longer contains a redefinition or module-build failure for
_SwiftSyntaxCShims. - If using the workaround, verify that
defaults read com.apple.dt.Xcode IDEPackageEnablePrebuiltsreturns0.
Cautions
Do not manually delete, edit, or add _SwiftSyntaxCShims to Package.swift. It is an internal support module, and changing it can further damage dependency resolution. If the same diagnostic remains on a fixed Xcode version, inspect the package graph for multiple direct or transitive swift-syntax versions.
Summary
Redefinition of module '_SwiftSyntaxCShims' in early Xcode 26 betas is a known problem in the Swift macro prebuilt support. Updating to Xcode 26 Beta 4 or later is the primary fix. Use Apple’s IDEPackageEnablePrebuilts NO workaround and clear Derived Data only when an update is not immediately possible.
