Just paste this gist link to your AI agent and ask to do.
LM Studio 0.4.x bundles older versions of mlx-vlm and mlx-lm that don't support Gemma 4. This guide upgrades both packages and removes a hardcoded block.
| LM Studio | MLX Engine | Bundled mlx-vlm | Bundled mlx-lm | Gemma 4 |
|---|---|---|---|---|
| 0.4.9 | 1.4.0 | 0.4.0 | 0.30.8 | ❌ |
| 0.4.11 | 1.5.0 | 0.4.0 | 0.31.2 | ❌ |
LM Studio code-signs all bundled native libraries (.so, .dylib) with its own Team ID. A full pip install --upgrade would replace these files with unsigned PyPI versions, causing dlopen errors.
Both mlx-vlm and mlx-lm are pure Python packages (no .so files), so upgrading them with --no-deps is safe.
killall "LM Studio"~/.lmstudio/bin/lms runtime lsLook for the mlx-llm-mac-arm64-apple-metal-* entry marked with ✓ and note the full name.
RUNTIME="<your-runtime-name-from-step-2>" # e.g. mlx-llm-mac-arm64-apple-metal-nax-advsimd@1.5.0
~/.lmstudio/bin/lms runtime remove "$RUNTIME" -y
~/.lmstudio/bin/lms runtime get "$RUNTIME" -y
~/.lmstudio/bin/lms runtime select "$RUNTIME"LM Studio keeps multiple runtime versions internally. Upgrade all of them.
mlx-lm doesn't have a Gemma 4 release on PyPI yet, so install from GitHub main:
PYTHON=$(ls ~/.lmstudio/extensions/backends/vendor/_amphibian/cpython3.11-mac-arm64@*/bin/python3.11 | head -1)
for sp in ~/.lmstudio/extensions/backends/vendor/_amphibian/app-mlx-generate-mac*-arm64@*/lib/python3.11/site-packages; do
"$PYTHON" -m pip install --target "$sp" --upgrade --no-deps mlx-vlm
"$PYTHON" -m pip install --target "$sp" --upgrade --no-deps "mlx-lm @ git+https://github.com/ml-explore/mlx-lm.git"
doneLM Studio 0.4.11+ ships with a hardcoded check in mlx_engine that rejects Gemma 4 models (mlx-engine#301). Remove it:
for f in ~/.lmstudio/extensions/backends/vendor/_amphibian/app-mlx-generate-mac*-arm64@*/lib/python3.11/site-packages/mlx_engine/generate.py; do
sed -i '' '/if model_type == "gemma4":/,/raise ValueError.*Gemma 4/d' "$f"
done- After LM Studio updates, the runtime may reset. Re-run steps 4–5 if Gemma 4 stops loading.
- Paths vary by macOS version — the glob patterns above handle both
mac14(macOS 14) andmac26(macOS 26) automatically. - Once
mlx-lmreleases Gemma 4 on PyPI, step 4 can usemlx-lminstead of the git URL.