whatisgithub

What is mlx-flux2-swift?

icakinser/mlx-flux2-swift — explained in plain English

Analysis updated 2026-05-18

26SwiftAudience · developerComplexity · 4/5Setup · hard

In one sentence

Run the FLUX.2 image generation model natively on Apple Silicon Macs using Swift. Generate, edit, and modify images without Python.

Mindmap

mindmap
  root((repo))
    What it does
      Text to image
      Edit existing images
      Mask guided editing
      Outpainting
    Tech stack
      Swift
      MLX framework
      Metal shaders
    Use cases
      Native image gen
      Swift app integration
      ComfyUI workflows
    Audience
      Swift developers
      Apple Mac users
    Requirements
      Apple Silicon Mac
      macOS 26 plus
      Xcode toolchain

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Generate images from text prompts on Apple Silicon Macs without Python.

USE CASE 2

Edit existing images with mask-guided tools to change or remove specific regions.

USE CASE 3

Extend images beyond their borders using outpainting.

USE CASE 4

Add image generation and editing to your own Swift apps with the Flux2Kit library.

What is it built with?

SwiftMLXMetalXcode

How does it compare?

icakinser/mlx-flux2-swiftbsnkhua/mole-widgeteeliberto/reset-macos
Stars262626
LanguageSwiftSwiftSwift
Setup difficultyhardeasyeasy
Complexity4/52/52/5
Audiencedevelopergeneraldeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · hard Time to first run · 1h+

Requires an Apple Silicon Mac, macOS 26+, Xcode toolchain, a helper script to compile Metal shaders, and separately downloading roughly 15 GB of model weights from Hugging Face.

The license for this repository is not specified in the available information.

So what is it?

This repository brings the FLUX.2 [klein] image generation model to Apple Silicon Macs using Swift and Apple's MLX framework. The usual way to run FLUX involves Python, but this project rebuilds it entirely in Swift so it runs natively on Apple hardware with no Python runtime involved. It was adapted from an existing MLX-based reference project and checked to produce matching image outputs at the same random seed. The project covers several image tasks. It can generate images from text prompts, modify existing images, and do mask-guided editing where you specify a region to change or remove. It also supports outpainting, which extends an image beyond its original borders. Beyond the model-based features, it includes a set of instant image operations that need no model at all: resizing, cropping, color adjustments, blur, sharpen, sepia, and similar effects that run in roughly 50 milliseconds. Memory usage was a clear focus. A set of opt-in options for quantization and staged loading brings peak memory down from about 12.6 GB to roughly 1.65 GB, which matters because the model weights themselves are large. The weights are not bundled in the repository. You download them separately from Hugging Face, where the FLUX.2 model snapshot is roughly 15 GB. The README walks through pointing the tools at wherever you store those files. Running the generation features requires an Apple Silicon Mac, macOS 26 or newer, and the full Xcode toolchain because a compiled Metal shader library is needed for GPU operations. The README notes that swift build alone does not produce this shader file, so a helper script must be run afterward. The instant image operations and some tests are CPU-only and skip that requirement. The repository also provides a Swift library called Flux2Kit for developers who want to build image features into their own Swift packages, along with a sample project and ComfyUI integration nodes for graphical workflows. The full README is longer than what was shown.

Copy-paste prompts

Prompt 1
How do I set up mlx-flux2-swift on my Apple Silicon Mac including downloading the FLUX.2 weights and compiling the Metal shaders?
Prompt 2
Show me how to use mlx-flux2-swift to generate an image from a text prompt with quantization enabled to keep memory under 2 GB.
Prompt 3
How do I integrate Flux2Kit into my own Swift package to add image generation features?
Prompt 4
Walk me through using mask-guided editing in mlx-flux2-swift to change a specific region of an existing image.
Prompt 5
How do I use the instant image operations like resize, crop, and blur in mlx-flux2-swift without needing the model weights?

Frequently asked questions

What is mlx-flux2-swift?

Run the FLUX.2 image generation model natively on Apple Silicon Macs using Swift. Generate, edit, and modify images without Python.

What language is mlx-flux2-swift written in?

Mainly Swift. The stack also includes Swift, MLX, Metal.

What license does mlx-flux2-swift use?

The license for this repository is not specified in the available information.

How hard is mlx-flux2-swift to set up?

Setup difficulty is rated hard, with roughly 1h+ to a first successful run.

Who is mlx-flux2-swift for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.