Hive Hive
Sign in

tuist xcodebuild fails to resolve dependencies on clean DerivedData when package name collides with SPM product name

GitHub issue · Open

Metadata
Source
tuist/tuist #9892
Updated
Jun 11, 2026
Domains
CLI Generated projects
Details

Description

tuist xcodebuild build fails with “Unable to find module dependency” errors on clean DerivedData when the Tuist Package.swift has a name that collides with an SPM product name. tuist build and plain xcodebuild -workspace both work fine in the same scenario.

Environment

  • Tuist version: 4.158.2 and 4.159.1 (both affected)
  • Xcode: 16.4 (26A5005l)
  • macOS: 15.5

Steps to reproduce

  1. Create a Tuist project where Tuist/Package.swift has name: "Dependencies" and includes swift-dependencies (by pointfreeco) as a dependency, which exports a product also named Dependencies
  2. Run tuist install and tuist generate
  3. Run tuist xcodebuild build -scheme "SomeScheme" with a clean DerivedData

Expected behavior

Build succeeds (same as tuist build and xcodebuild -workspace).

Actual behavior

Build fails with errors like:

Unable to find module dependency: 'Dependencies'
Unable to find module dependency: 'DependenciesMacros'

Key observations

Command Clean DerivedData Warm DerivedData
tuist build "Scheme" Works Works
xcodebuild -workspace Generated.xcworkspace -scheme "Scheme" Works Works
tuist xcodebuild build -scheme "Scheme" Fails Works (masked)

The fact that tuist build and plain xcodebuild -workspace both work suggests that tuist xcodebuild handles workspace/project resolution or dependency graph differently in a way that triggers the name collision.

Investigation

Looking at XcodeBuildBuildCommandService.swift, the projectPath() method auto-discovers the workspace/project by globbing the current directory. The resolution order (xcodeproj before xcworkspace) or some other aspect of how tuist xcodebuild sets up the xcodebuild invocation may cause the dependency resolution to fail when there’s a package name collision.

Renaming the Tuist Package.swift name to something unique (e.g., "NotionExternalDependencies") does NOT fix the issue with tuist xcodebuild — the collision seems to be deeper than just the package name string.

Workaround

Use tuist build for clean/first builds, then tuist xcodebuild for incremental builds (where DerivedData is warm). This is what we’ve implemented in our Makefile.

Comments
L
linear[bot] Mar 17, 2026
D
dosubot[bot] Mar 17, 2026

Hi @bprinsta! I’m Dosu and I’m helping the tuist team.

Thanks for the detailed report! I found some relevant information that explains the behavior you’re seeing.

The root cause is that tuist xcodebuild build is a lightweight wrapper that doesn’t regenerate projects or load dependency graphs, while tuist build always generates/loads the full project graph. This explains why tuist build works but tuist xcodebuild build fails on clean DerivedData.

Additionally, the projectPath() method prefers .xcodeproj over .xcworkspace during auto-discovery, which can cause SPM dependencies to be missed if both exist in your directory.

Recommended workaround: Explicitly specify the workspace in your tuist xcodebuild call:

tuist xcodebuild build -workspace YourApp.xcworkspace -scheme "SomeScheme"

This should ensure SPM dependencies are properly resolved. There’s also a related issue that discusses similar module dependency failures with tuist xcodebuild build.

If you’d like to dig deeper into this with a coding agent to explore whether there’s a generated project issue, you can install this debugging skill following the agent-skills repo. If that doesn’t yield a solution, providing a minimal reproducible project would help the maintainers investigate further.

To reply, just mention @dosu.


Docs are dead. Just use Dosu.

Leave Feedback Ask Dosu about tuist Share Dosu with your team

F
fortmarek Mar 18, 2026

Hey @bprinsta 👋

As dosubot mentioned, tuist xcodebuild build is an extremely thin wrapper around xcodebuild build that’s primarily there for automatically tracking builds insights.

Why is your tuist xcodebuild build invocation different from the xcodebuild one? Have you tried running xcodebuild -workspace Generated.xcworkspace -scheme "Scheme"?

Create a Tuist project where Tuist/Package.swift has name: “Dependencies” and includes swift-dependencies (by pointfreeco) as a dependency, which exports a product also named Dependencies Run tuist install and tuist generate Run tuist xcodebuild build -scheme “SomeScheme” with a clean DerivedData

Instead of steps to reproduce, what would be more useful is to attach a reproducible sample that we could work with directly 🙏