Installation
MLX is available on PyPI with platform-specific packages for macOS and Linux. Choose the installation method that matches your platform and requirements.macOS (Apple Silicon)
MLX runs natively on Apple silicon Macs using the Metal GPU backend.Requirements
- M-series chip (Apple silicon)
- macOS >= 14.0
- Python >= 3.10 (native, not x86 via Rosetta)
Install with pip
MLX is only available on devices running macOS 14.0 or higher.
Verify Python Architecture
Ensure you’re using native Python (not running via Rosetta):arm. If it shows i386, you’re using a non-native Python. Switch to a native Python installation using Conda or another package manager.
Linux
MLX supports Linux with CUDA GPU acceleration or CPU-only execution.CUDA Backend
For NVIDIA GPUs with CUDA support:Requirements
- NVIDIA architecture >= SM 7.5
- NVIDIA driver >= 550.54.14
- CUDA toolkit >= 12.0
- Linux distribution with glibc >= 2.35
- Python >= 3.10
Install with pip
CPU-Only Backend
For running MLX on Linux without GPU acceleration:Requirements
- Linux distribution with glibc >= 2.35
- Python >= 3.10
Install with pip
Troubleshooting
pip cannot find a matching distribution
pip cannot find a matching distribution
If your OS and Python versions meet the requirements but pip still fails, you’re likely using a non-native Python.Check your Python architecture:On macOS with Apple silicon, this should output
arm. If it shows i386, switch to a native Python installation.Import error after installation
Import error after installation
Ensure you’re using Python 3.10 or later:On macOS, verify you’re running macOS 14.0 or higher:
Building from Source
For advanced users who need to build from source, MLX supports custom builds with various configuration options.Requirements
- C++ compiler with C++20 support (e.g., Clang >= 15.0)
- CMake >= 3.25
- macOS: Xcode >= 15.0 with macOS SDK >= 14.0
- Linux (CPU): BLAS and LAPACK libraries
- Linux (CUDA): CUDA toolkit and cuDNN
Clone and Build
For detailed C++ build instructions and advanced configuration options, see the Build from Source documentation.
Next Steps
Quick Start Tutorial
Learn how to create your first MLX arrays and perform basic operations