Skip to content

Executable Built with swift-subprocess Fails to Launch on macOS #189

@omochi

Description

@omochi

Describe the bug

On macOS, using swift-subprocess causes executables to fail to launch.
At startup, an error occurs stating that libswiftCompatibilitySpan.dylib cannot be found.

Interestingly, it runs fine when opened and executed in Xcode; the issue occurs only with the SwiftPM CLI.

To Reproduce

A simple program like the one below reproduces the issue.

import Subprocess

@main
struct App {
    static func main() async throws {
        let result = try await Subprocess.run(
            .name("tar"),
            arguments: ["-cvf", "archive.tar", "Sources/"],
            output: .standardOutput,
            error: .standardError
        )

        guard result.terminationStatus.isSuccess else {
            throw "failed to tar"
        }
    }
}

You can reproduce the issue by checking out the following repository and running swift build && swift run.
https://github.com/omochi/swift-subprocess-rpath-bug

Expected behavior

The executable should launch and run successfully.

Environment (please complete the following information):

  • macOS 26.0 Tahoe 25A354
  • Xcode 26.1 Beta 1
  • swift-driver version: 1.127.14.1 Apple Swift version 6.2.1 (swiftlang-6.2.1.1.1 clang-1700.4.1.1)

Additional information

The following issue seems related.
swiftlang/swift-package-manager#9163

It was closed as fixed in Swift 6.2.1; however, the problem still occurs in Xcode 26.1 beta 1, which bundles Swift 6.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions