Describe the bug
When mlx-swift is integrated via Tuist, runtime crashes on iOS device with:
Failed to load the default metallib (library not found).
MLX searches for mlx-swift_Cmlx.bundle/default.metallib, but Tuist doesn't emit the SwiftPM resource bundle for external dependencies (because the metallib is a build artifact, not declared as a resource). As a result the bundle is missing at runtime.
To Reproduce
Include code snippet
// Minimal usage that triggers MLX init
import MLX
import Cmlx
// e.g. initialize MLX or any model load
Steps:
- Create a Tuist project that depends on
mlx-swift (Cmlx + MLX).
- Build & run on a real iOS device (not simulator).
- App/test host crashes with “Failed to load the default metallib (library not found)”.
Workaround (build script):
# Copy default.metallib into SwiftPM bundle path expected by MLX
BUNDLE_DIR="${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/mlx-swift_Cmlx.bundle"
mkdir -p "${BUNDLE_DIR}"
cp -f "${BUILT_PRODUCTS_DIR}/Cmlx.framework/default.metallib" "${BUNDLE_DIR}/default.metallib"
Related MLX source (load paths):
Expected behavior
MLX should find its metallib when integrated via Tuist (or any build system that doesn’t auto-generate SwiftPM resource bundles for external deps). Ideally default.metallib should be declared as a SwiftPM resource or shipped in a stable bundle path.
Desktop (please complete the following information):
- OS Version: macOS 26.2 (host), iOS 26.2.1 (device)
- Device: iPhone Air (iOS 26.2.1)
- Version: mlx-swift (main), Tuist 4.133.4, Xcode 26.2
Additional context
Tuist does not auto-emit SwiftPM resource bundles for external dependencies when the resource is a build artifact. The workaround above copies default.metallib into mlx-swift_Cmlx.bundle and fixes the crash.
Describe the bug
When mlx-swift is integrated via Tuist, runtime crashes on iOS device with:
Failed to load the default metallib (library not found).MLX searches for
mlx-swift_Cmlx.bundle/default.metallib, but Tuist doesn't emit the SwiftPM resource bundle for external dependencies (because the metallib is a build artifact, not declared as a resource). As a result the bundle is missing at runtime.To Reproduce
Include code snippet
Steps:
mlx-swift(Cmlx + MLX).Workaround (build script):
Related MLX source (load paths):
Expected behavior
MLX should find its metallib when integrated via Tuist (or any build system that doesn’t auto-generate SwiftPM resource bundles for external deps). Ideally
default.metallibshould be declared as a SwiftPM resource or shipped in a stable bundle path.Desktop (please complete the following information):
Additional context
Tuist does not auto-emit SwiftPM resource bundles for external dependencies when the resource is a build artifact. The workaround above copies
default.metallibintomlx-swift_Cmlx.bundleand fixes the crash.