{"slug":"mlx-lm","name":"MLX LM","kind":"runbook","what":"Apple's MLX-native way to generate, chat, fine-tune and serve LLMs on Apple silicon.","page":"https://insidethemachine.ai/setups/mlx-lm","status":"docs-checked","status_label":"Not run: commands checked against the official docs only","status_note":"Commands checked against the official docs on 2026-10-15. Not run end to end.","wrapper":"The wrapper scripts are generated from the site data. Every .sh passed bash -n and shellcheck and ran in plan mode on Linux (Debian 13). Every .ps1 passed the PowerShell parser and chat.ps1 ran in plan, verify and rollback mode under PowerShell 7 on Linux with Windows calls mocked. Not run on macOS or real Windows.","wrapper_tested":null,"sh":"https://insidethemachine.ai/install/mlx-lm.sh","ps1":null,"md":"https://insidethemachine.ai/install/mlx-lm.md","json":"https://insidethemachine.ai/install/mlx-lm.json","one_liner":"curl -fsSL https://insidethemachine.ai/install/mlx-lm.sh | bash","one_liner_windows":null,"actions":{"install":"curl -fsSL https://insidethemachine.ai/install/mlx-lm.sh | bash","plan":"curl -fsSL https://insidethemachine.ai/install/mlx-lm.sh | bash -s -- plan","verify":"curl -fsSL https://insidethemachine.ai/install/mlx-lm.sh | bash -s -- verify","rollback":"curl -fsSL https://insidethemachine.ai/install/mlx-lm.sh | bash -s -- rollback --yes"},"env":{"ITM_RAM":"memory in GB instead of detecting it"},"model_by_memory_gb":null,"low_memory":null,"platforms":{"macos":{"install":[{"title":"Install MLX LM","lines":[{"k":"run","c":"python3 -m venv ~/.venvs/mlx && source ~/.venvs/mlx/bin/activate"},{"k":"run","c":"pip install mlx-lm"},{"k":"note","c":"or with conda: conda install -c conda-forge mlx-lm"}]},{"title":"Configure (your choices)","lines":[{"k":"you","c":"mlx_lm.server --model mlx-community/Mistral-7B-Instruct-v0.3-4bit","why":"starts an OpenAI-like server on localhost:8080; model downloads from Hugging Face on first run"},{"k":"you","c":"mlx_lm.server --model <hf_repo_or_path> --kv-bits 4 --prefill-step-size 512","why":"quantized KV cache for long contexts"}]}],"verify":[{"run":"mlx_lm.generate --model mlx-community/Mistral-7B-Instruct-v0.3-4bit --prompt \"hello\"","expect":"prints generated text and tokens-per-second stats"},{"run":"curl -s http://localhost:8080/v1/chat/completions -H 'Content-Type: application/json' -d '{\"messages\":[{\"role\":\"user\",\"content\":\"Say hi\"}]}'","expect":"JSON response with a choices[0].message.content field (server must be running)"}],"rollback":[{"k":"run","c":"pip uninstall -y mlx-lm"},{"k":"run","c":"rm -rf ~/.venvs/mlx"},{"k":"note","c":"downloaded models live in the Hugging Face cache (~/.cache/huggingface/hub); delete specific model folders to free space"}]},"linux":null,"windows":null}}