Error: Redefinition of module 'SwiftBridging' after fresh install

Having an issue with a fresh install of tuist 4.38.2 , Xcode 16.2, Sequoia 15.2, Apple M3.

Running tuist init or trying to run on existing project I get the same errors:

tuist init --name MyApp                                  
The 'swift' command exited with error code 1 and message:
/Library/Developer/CommandLineTools/usr/include/swift/module.modulemap:13:8: error: redefinition of module 'SwiftBridging'
11 | //===----------------------------------------------------------------------===//
12 | 
13 | module SwiftBridging {
   |        `- error: redefinition of module 'SwiftBridging'
14 |     header "bridging"
15 | 

/Library/Developer/CommandLineTools/usr/include/swift/bridging.modulemap:13:8: note: previously defined here
11 | //===----------------------------------------------------------------------===//
12 | 
13 | module SwiftBridging {
   |        `- note: previously defined here
14 |     header "bridging"
15 | 

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Modules/Foundation.swiftmodule/arm64e-apple-macos.swiftinterface:5:8: error: failed to build module 'CoreFoundation'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 6.0.3 effective-5.10 (swiftlang-6.0.3.1.5 clang-1600.0.30.1)', while this compiler is 'Apple Swift version 6.0.3 effective-5.10 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)'). Please select a toolchain which matches the SDK.
    3 | // swift-module-flags: -target arm64e-apple-macos15.2 -target-variant arm64e-apple-ios18.2-macabi -enable-objc-interop -autolink-force-load -enable-library-evolution -module-link-name swiftFoundation -swift-version 5 -enforce-exclusivity=unchecked -O -library-level api -enable-upcoming-feature InferSendableFromCaptures -enable-bare-slash-regex -user-module-version 3208 -module-name Foundation -package-name "\"FoundationPreview\""
    4 | import Combine
    5 | import CoreFoundation
      |        `- error: failed to build module 'CoreFoundation'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 6.0.3 effective-5.10 (swiftlang-6.0.3.1.5 clang-1600.0.30.1)', while this compiler is 'Apple Swift version 6.0.3 effective-5.10 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)'). Please select a toolchain which matches the SDK.
    6 | import Darwin
    7 | import Dispatch

/Library/Developer/CommandLineTools/usr/include/swift/module.modulemap: 0:
/Library/Developer/CommandLineTools/usr/include/swift/bridging.modulemap: 0:
/Users/reedjsmith/.local/share/mise/installs/tuist/4.38.2/bin/ProjectDescription.framework/Modules/ProjectDescription.swiftmodule/arm64-apple-macos.private.swiftinterface:4:8: error: failed to build module 'Foundation'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 6.0.3 effective-5.10 (swiftlang-6.0.3.1.5 clang-1600.0.30.1)', while this compiler is 'Apple Swift version 6.0.3 effective-5.10 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)'). Please select a toolchain which matches the SDK.
   2 | // swift-compiler-version: Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
   3 | // swift-module-flags: -target arm64-apple-macos13.0 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -enable-bare-slash-regex -module-name ProjectDescription
   4 | import Foundation
     |        `- error: failed to build module 'Foundation'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 6.0.3 effective-5.10 (swiftlang-6.0.3.1.5 clang-1600.0.30.1)', while this compiler is 'Apple Swift version 6.0.3 effective-5.10 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)'). Please select a toolchain which matches the SDK.
   5 | import Swift
   6 | import _Concurrency

/Users/reedjsmith/.local/share/mise/installs/tuist/4.38.2/bin/Templates/default/default.swift:1:8: error: failed to build module 'ProjectDescription'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)', while this compiler is 'Apple Swift version 6.0.3 effective-5.10 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)'). Please select a toolchain which matches the SDK.
 1 | import ProjectDescription
   |        `- error: failed to build module 'ProjectDescription'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)', while this compiler is 'Apple Swift version 6.0.3 effective-5.10 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)'). Please select a toolchain which matches the SDK.
 2 | 
 3 | let nameAttribute: Template.Attribute = .required("name")

Consider creating an issue using the following link: https://github.com/tuist/tuist/issues/new/choose

Hey @reedsmith!

Would you mind trying with some of the older versions, such as 4.37.0 and 4.36.0 to see if this is a new issue? Would you mind also passing the output of tuist init --verbose? That includes the exact underlying swift command that’s failing.

That being said, I’m unable to reproduce. @pepicrft, any ideas?

@marekfort 4.37 worked.

tuist init --verbose    
/usr/bin/xcrun swift -suppress-warnings -I /Users/reedjsmith/.local/share/mise/installs/tuist/4.37.0/bin -L /Users/reedjsmith/.local/share/mise/installs/tuist/4.37.0/bin -F /Users/reedjsmith/.local/share/mise/installs/tuist/4.37.0/bin -lProjectDescription -framework ProjectDescription /Users/reedjsmith/.local/share/mise/installs/tuist/4.37.0/bin/Templates/default/default.swift --tuist-dump
TUIST_MANIFEST_START
{"attributes":[{"required":{"_0":"name"}},{"optional":{"_0":"platform","default":{"string":{"_0":"iOS"}}}}],"description":"Default template","items":[{"contents":{"file":{"_0":{"pathString":"AppProject.stencil","type":"relativeToManifest"}}},"path":".\/Project.swift"},{"contents":{"file":{"_0":{"type":"relativeToManifest","pathString":"Package.stencil"}}},"path":".\/Tuist\/Package.swift"},{"path":".\/Tuist.swift","contents":{"file":{"_0":{"type":"relativeToManifest","pathString":"Tuist.stencil"}}}},{"contents":{"file":{"_0":{"type":"relativeToManifest","pathString":"app.stencil"}}},"path":".\/{{ name }}\/Sources\/{{ class_name }}App.swift"},{"contents":{"file":{"_0":{"pathString":"ContentView.stencil","type":"relativeToManifest"}}},"path":".\/{{ name }}\/Sources\/ContentView.swift"},{"path":".\/{{ name }}\/Resources","contents":{"directory":{"_0":{"type":"relativeToManifest","pathString":"{{ platform }}\/Assets.xcassets"}}}},{"contents":{"directory":{"_0":{"type":"relativeToManifest","pathString":"Preview Content"}}},"path":".\/{{ name }}\/Resources"},{"path":".\/{{ name }}\/Tests\/{{ class_name }}Tests.swift","contents":{"file":{"_0":{"type":"relativeToManifest","pathString":"AppTests.stencil"}}}},{"path":".gitignore","contents":{"file":{"_0":{"pathString":"Gitignore.stencil","type":"relativeToManifest"}}}},{"contents":{"file":{"_0":{"type":"relativeToManifest","pathString":"mise.stencil"}}},"path":".mise.toml"}]}
TUIST_MANIFEST_END

Project generated at path /Users/reedjsmith/Tuist. Run `tuist generate` to generate the project and open it in Xcode. Use `tuist edit` to easily update the Tuist project definition.
To learn more about tuist features, such as how to add external dependencies or how to use our ProjectDescription helpers, head to our tutorials page: https://docs.tuist.io/tutorials/tuist-tutorials
mise WARN  Config files in ~/Tuist/.mise.toml are not trusted.                                                                    
Trust them with `mise trust`. See https://mise.jdx.dev/cli/trust.html for more information.

Thanks @reedsmith! We slightly changed how ProjectDescription is built in 4.38, so it’s most likely related to that. We’ll look into it :pray:

I think this is a regression I introduced when I adjusted the release workflow to sign the artifacts. @reedsmith would you mind downloading the following artifact and then running tuist from there:

/path/to/unzipped/tuist generate --path /path/to/your/project

If it works I’ll go ahead with a fix.

tuist.zip (30.9 MB)