Rust bindings for Apple's MLX framework.
Platform: Apple Silicon (macOS) only.
The bindings are layered, the same way as MLX Swift:
mlxcore (safe, idiomatic Rust API) <- crates/mlxcore
mlxcore-sys (raw unsafe FFI bindings) <- crates/mlxcore-sys, generated by bindgen
mlx-c (Apple's C API for MLX) <- third_party/mlx-c (git submodule)
mlx (Apple's C++ framework) <- fetched by mlx-c's CMake build
MLX itself is C++, which Rust cannot bind to directly. We bind against
mlx-c, Apple's official C API, whose
CMake build pulls in MLX via FetchContent.
git submodule update --init --recursive
make build
make testRequirements: a recent Rust toolchain, make, cmake, and Xcode command-line tools.
The first build compiles MLX from source and takes several minutes.
Runnable examples live in crates/mlxcore/examples:
cargo run --example hellometal(default) — GPU backend via Metal.accelerate(default) — CPU BLAS via Apple's Accelerate framework.