Skip to content

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

sw_vers                # confirm macOS Sonoma (14) or later
python3 --version      # need 3.11 or 3.12

If Python needs installing:

brew install python@3.12


1. Project folder and virtual environment

mkdir -p ~/local-llm-vllm && cd ~/local-llm-vllm
python3.12 -m venv venv
source venv/bin/activate

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

pip install --upgrade pip
pip install vllm-metal

** 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:

pip uninstall vllm
and stay with vllm-metal only.

Check the actual command name this package provides — it is vllm-metal, not vllm:

ls venv/bin/ | grep -i vllm
vllm-metal --help


3. Download the model

pip install huggingface_hub
hf download scb10x/typhoon2.5-qwen3-4b

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:

ls -lh ~/.cache/huggingface/hub/models--scb10x--typhoon2.5-qwen3-4b/blobs/
Done when no filenames end in .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')"
Run this while the server is live, in a separate terminal (with the venv activated) — gives the real MLX-reported memory footprint rather than an estimate.


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
Note: this specific bench tool ships with mainline 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):

launchctl list | grep vllm-metal

Watch logs:

tail -f ~/local-llm-vllm/vllm-metal.log

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.