Install vllm-metal with Typhoon2.5-4B on macOS
Final working stack: vllm-metal (engine) serving Typhoon2.5-4B (model), running natively on macOS as a persistent launchd service.
Prerequisites¶
If Python needs installing:
1. Project folder and virtual environment¶
source venv/bin/activate must be re-run in every new terminal window — packages installed inside the venv are invisible otherwise (command not found / ModuleNotFoundError are both usually this).
2. Install the engine — use vllm-metal, not mainline vllm¶
** Do not run pip install vllm on this machine.** Mainline vLLM has no official macOS wheels and will try to compile from source, which fails on Apple Silicon due to a real compiler incompatibility (static_assert(0 < M <= 8) chained-comparison error in newer AppleClang). If this happens:
vllm-metal only.
Check the actual command name this package provides — it is vllm-metal, not vllm:
3. Download the model¶
Notes from the real download:
- huggingface-cli is deprecated — use hf instead.
- This pulls the full fp16 version, ~9-10GB total (not a small quantized file — there is no automatic quantization here).
- Unauthenticated downloads are rate-limited and can appear to stall. If interrupted (e.g. accidental Ctrl+C), hf download run again is resume-aware and continues from .incomplete files rather than restarting.
- To verify progress manually:
.incomplete.
4. Launch the server (the command that actually works)¶
VLLM_METAL_USE_PAGED_ATTENTION=1 VLLM_METAL_MEMORY_FRACTION=0.75 \
vllm-metal --model scb10x/typhoon2.5-qwen3-4b \
--host 0.0.0.0 \
--port 8001 \
--log-level info
Important: this build's CLI (vllm-metal --help) only supports --model, --host, --port, --log-level. There is no --max-model-len, --max-num-seqs, --tool-call-parser, --enable-auto-tool-choice, or --gpu-memory-utilization flag on this version — those apply to mainline vllm serve, which doesn't build on this machine.
Memory is controlled instead via environment variables:
- VLLM_METAL_USE_PAGED_ATTENTION=1 — enables the paged-attention path
- VLLM_METAL_MEMORY_FRACTION=0.75 — sets the memory budget (only usable with paged attention enabled; on the plain MLX path this must be auto)
Confirmed working startup log:
Loading model: scb10x/typhoon2.5-qwen3-4b
Model loaded successfully
Starting server on 0.0.0.0:8001
Uvicorn running on http://0.0.0.0:8001
5. Test it¶
curl http://localhost:8001/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "scb10x/typhoon2.5-qwen3-4b",
"messages": [{"role": "user", "content": "สวัสดี, what can you help with?"}]
}'
Confirmed real response received (Thai in, Thai out) — verifies model load, server, and language handling all work together.
6. Check memory usage directly¶
python3 -c "import mlx.core as mx; print(mx.get_active_memory() / 1e9, 'GB active'); print(mx.get_peak_memory() / 1e9, 'GB peak')"
7. Load-test concurrency (not yet run — do this next)¶
vllm bench serve --base-url http://localhost:8001 \
--model scb10x/typhoon2.5-qwen3-4b \
--max-concurrency 6 \
--num-prompts 30
vllm, which doesn't build here — check whether vllm-metal exposes an equivalent, or benchmark manually with parallel curl calls / a small script instead.
8. Run it as a persistent macOS service (launchd)¶
Create ~/Library/LaunchAgents/com.local.vllm-metal.plist:
mkdir -p ~/Library/LaunchAgents
cat > ~/Library/LaunchAgents/com.local.vllm-metal.plist << 'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.local.vllm-metal</string>
<key>ProgramArguments</key>
<array>
<string>/Users/<USER>/local-llm-vllm/venv/bin/vllm-metal</string>
<string>--model</string>
<string>scb10x/typhoon2.5-qwen3-4b</string>
<string>--host</string>
<string>0.0.0.0</string>
<string>--port</string>
<string>8001</string>
<string>--log-level</string>
<string>info</string>
</array>
<key>EnvironmentVariables</key>
<dict>
<key>VLLM_METAL_USE_PAGED_ATTENTION</key>
<string>1</string>
<key>VLLM_METAL_MEMORY_FRACTION</key>
<string>0.75</string>
<key>PATH</key>
<string>/Users/<USER>/local-llm-vllm/venv/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
</dict>
<key>WorkingDirectory</key>
<string>/Users/<USER>/local-llm-vllm</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardOutPath</key>
<string>/Users/<USER>/local-llm-vllm/vllm-metal.log</string>
<key>StandardErrorPath</key>
<string>/Users/<USER>/local-llm-vllm/vllm-metal-error.log</string>
</dict>
</plist>
EOF
Load and start:
launchctl load ~/Library/LaunchAgents/com.local.vllm-metal.plist
launchctl start com.local.vllm-metal
Confirm running (a 0 in the middle column = healthy):
Watch logs:
Useful commands:
launchctl stop com.local.vllm-metal
launchctl start com.local.vllm-metal
launchctl unload ~/Library/LaunchAgents/com.local.vllm-metal.plist # full removal
lsof -ti:8001 | xargs kill # force-kill if port is stuck
Note: this is a LaunchAgent (runs in the user session at login), not a LaunchDaemon (system-wide, no login needed) — deliberate, since Metal/GPU access is generally more reliable inside an active user session.
Verify auto-restart works:
kill <pid-from-launchctl-list>
# wait a few seconds, then:
launchctl list | grep vllm-metal # should show a new PID
9. Next step — not yet done¶
Update main.py (FastAPI backend) to call http://<UTM_GATEWAY_IP>:8001/v1/chat/completions (the UTM VM gateway address, not localhost) using vLLM's OpenAI-style request/response shape instead of Ollama's /api/generate format used earlier in development.