Skip to content

Use prebuilt XCFramework distribution of MLX #9

Closed as not planned
Closed as not planned

Description

@Lakr233

Hello,

Thank you for this valuable repository that consolidates the necessary resources. I am planning to switch to it.

Currently, when I'm building my AI app, it takes 75% of the time building MLX-related codes, which takes really long. I'm wondering if it is possible to build a variant that packs all the backend (MLX, llama.cpp, ...) into a single .xcframework that is static for linking. This would save many hours and computing time on Xcode Cloud.

And if you accept PR, I'd like to make one.

:)

Activity

  1. mattt commented on Oct 29, 2025

    @mattt
    Collaborator

    @Lakr233 Glad to hear that you found this to be useful!

    I agree that a binary XCFramework dependency for MLX would be a big improvement. I've been tracking this issue, which recently got this PR, which should help get us there.

  2. added
    enhancement
    on Nov 3, 2025
  3. changed the title [-]Prebuilt Binary for Faster Build[/-] [+]Use prebuilt XCFramework distribution of MLX[/+] on Dec 11, 2025
  4. mattt commented on Feb 5, 2026

    @mattt
    Collaborator

    I just opened up ml-explore/mlx-swift#351 to add release automation so that future releases of mlx-swift have XCFramework assets that we can target directly.

  5. mattt commented on Sep 2, 2026

    @mattt
    Collaborator

    Update: ml-explore/mlx-swift#351 merged in February, so releases of mlx-swift now ship XCFramework assets. That removes the blocker here. Anyone who wants to take a pass at targeting them in Package.swift is welcome; otherwise I'll get to it after 1.0.

  6. mattt commented on Oct 1, 2026

    @mattt
    Collaborator

    Hi @Lakr233. Following up on my last update: after looking into this more closely, I don't think we can do this well from AnyLanguageModel, so I'm going to close it as not planned.

    mlx-swift now attaches XCFrameworks to its releases, but AnyLanguageModel uses MLX through mlx-swift-lm, which builds from source and brings in mlx-swift as source too. Adding the binary MLX and Cmlx targets next to that would put two copies of each module in the package. To make it work, we'd also have to build and host XCFrameworks for mlx-swift-lm (Cmlx alone is over 200 MB zipped per release), replace its #huggingFaceTokenizerLoader() macro, and keep all of it in step with every MLX release. That's more than we can maintain here. A binary target in mlx-swift itself was declined in ml-explore/mlx-swift#406, for reasons that apply to us too, like keeping source builds and Linux working.

    If mlx-swift-lm ships a binary distribution someday, I'd be glad to revisit this. Let me know if you have any more thoughts on the matter!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions