One-line summary
MLX is Apple's open-source machine learning framework that runs open-source LLMs directly on Apple Silicon Macs (M1 and later); this guide covers the full workflow from installation and model download to chat generation and a local server.
When to Use
Running open-source LLMs locally on a Mac fits three scenarios: privacy-sensitive work (documents and code never leave the device), offline environments, and low-latency debugging or cost control (no API fees). On October 16, 2026, Meta released the open-weight Muse Spark Open model in partnership with Apple, running the full model locally on two Mac Studios with 512GB memory via MLX — demonstrating MLX's local inference capability.
Step-by-Step Instructions
- Check hardware and OS: Apple Silicon Mac (M1/M2/M3/M4 series), macOS 13 or later, Python 3.9 or later.
- Install mlx-lm: run
pip install mlx-lmin a terminal (use a virtual environment or uv for dependency management). - Pick a model by unified memory: 8GB suits 3B–7B quantized models, 32GB can run 30B-class quantized models, 64GB and above can run 70B-class.
- Download and run the model: run
python -m mlx_lm.generate --model mlx-community/Meta-Llama-3.1-8B-Instruct-4bit --prompt "Hello"; the first run downloads weights from Hugging Face automatically. - Start a local server: run
python -m mlx_lm.server --model mlx-community/Meta-Llama-3.1-8B-Instruct-4bit --port 8080for an OpenAI-compatible endpoint atlocalhost:8080. - Quantize your own model: run
python -m mlx_lm.convert --hf-path MODEL_DIR -qto produce a 4-bit quantized version that uses less memory.
Notes
- Memory is the main bottleneck: memory needed ≈ parameters (in billions) × bits ÷ 8 GB; a 7B model at 4-bit needs roughly 4GB.
- The first run downloads weights over the network; afterwards the model works offline.
- Muse Spark Open (816 billion total / 42 billion active parameters) requires Mac Studios with 512GB memory to run fully locally; regular Macs are better suited to quantized small and medium models.
- MLX only supports Apple Silicon (M series); Intel Macs are not supported.
