Local LLMs on Apple Silicon with Ollama MLX
Run MLX-format models in Ollama on Apple Silicon, plus how to diagnose Cloudflare Tunnel 403s — including Ollama's Host header check, which is one common cause but not the only one.
Free
Local LLMs on Apple Silicon with Ollama MLX
Example session with this skill installed
I need to deploy Qwen3.8-27B-Uncensored-MLX on my Mac Studio and make it accessible to my remote agent via a Cloudflare Tunnel. Help me with the import and the tunnel 403 fix.
- Read your context and instructions
- Compiled the local llms on
- Prereqs:
ollama --versionshows 0.19 or newer;xcode-select --install;python3 -m pip install --user -U "huggingface_hub[cli]". - Download:
python3 -c "from huggingface_hub import snapshot_download; snapshot_download(repo_id='orcarouter/Qwen3.8-27B-Uncensored-MLX', allow_patterns='6-bit/*', local_dir='~/models/qwen3.8-mlx-6bit')"— the repo folders are hyphenated (6-bit/, not6bit/); a wrong pattern silently fetches 0 files, so confirm the tree first. 6-bit is about 22.8GB. - Import:
echo "FROM ~/models/qwen3.8-mlx-6bit/6-bit" > ~/Modelfilethenollama create --experimental qwen3.8-27b-mlx -f ~/Modelfile. Without--experimentalit fails withError: unknown data type: U32; success prints the imported layer count. - Benchmark from the API, not by feel:
curl http://localhost:11434/api/chat -d '{"model":"qwen3.8-27b-mlx","messages":[{"role":"user","content":"Say hello in one sentence."}],"stream":false}', then tok/s =eval_count / (eval_duration / 1e9). - Diagnose before editing any config — three checks: (a)
curl -sS -o /dev/null -w '%{http_code}' https://ollama.example.com/api/tagswith no extra headers; (b) the same call straight tohttp://<host>:11434/api/tagsshould return 200; (c) re-request through the tunnel with a bogus Host header and compare response body sizes — Cloudflare Access/WAF 403s return HTML, an Ollama Host-check 403 returns an empty body. - Only if it is the Host check: in
config.ymlset the ingress rule (hostnameollama.example.com, servicehttp://localhost:11434,originRequest: httpHostHeader: "localhost:11434") with a final catch-allhttp_status: 404, then runcloudflared tunnel ingress validateand restart the tunnel. - Verify: the
/api/tagscall from step 5 now returns 200 andollama psshows the model loaded. - Reverse test: stop the tunnel (or hit the host from outside directly) and confirm it is NOT reachable — otherwise you have only proven it works, not that it is closed. If the endpoint stays public, add authentication and rate limiting.
- Persist:
launchctl setenv OLLAMA_KEEP_ALIVE -1(or export in~/.zshrc) and restart Ollama so the model stays loaded. - Agent side: point an OpenAI-compatible provider's
base_urlathttps://ollama.example.com/v1.
Connects securely to your tools. The creator never sees your data.
About this skill
How to run LLMs on Apple Silicon with Ollama 0.19 or newer, which has a built-in MLX engine — and why GGUF models on a Mac stay on the llama.cpp/Metal path and never get MLX acceleration. The guide covers the install (download the official script with curl -fsSL https://ollama.com/install.sh -o /tmp/ollama-install.sh, review it, then sh /tmp/ollama-install.sh, or use the official .dmg), downloading MLX safetensors from Hugging Face, importing them with ollama create --experimental (without the flag the import fails with unknown data type: U32), measuring real throughput from eval_count/eval_duration, and diagnosing Cloudflare Tunnel 403s. On the 403 side it starts with a three-step check (direct request, LAN request, bogus Host header comparison — Cloudflare Access/WAF 403s carry HTML, Ollama's Host check returns an empty body) before changing anything, then the httpHostHeader ingress fix and a reverse test to prove the endpoint is not exposed to the world. Example models use uncensored/abliterated Qwen MLX packs; they are optional suggestions, and tool-calling support varies by release. Knowledge only — one document, no bundled installer, scripts, or weights.
Requires an Apple Silicon Mac; Intel Macs and Windows/Linux are outside this guide. Ollama 0.19 or newer is required for the built-in MLX engine. MLX acceleration only applies to MLX-format weights — GGUF models run on the llama.cpp/Metal path here (a 27B GGUF measured ~6.2 tok/s) and get no benefit. Imports need the --experimental flag on ollama create, and the Xcode Command Line Tools (roughly 2GB) on first python3 use. Expect large downloads (the 6-bit 27B pack is about 22.8GB), and keep in mind that a Cloudflare Tunnel 403 has several possible causes — the Host header fix only covers one of them.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 16 days ago
- Free with an Agensi account
Mac only
- Accounts
Hugging Face
- Software
Ollama 0.19+Xcode CLT (~2GB)
- Optional
- huggingface_hubCloudflare Tunnel
Knowledge-only: one SKILL.md, no scripts or weights. Covers Ollama 0.19+ MLX on Apple Silicon, importing MLX safetensors with --experimental, tok/s measurement, and Cloudflare Tunnel 403s from Ollama's Host header check. GGUF sees no MLX speedup. Host header is one cause, not all; add auth first.
Permissions
Allowed Hosts
What's inside
Frequently Asked Questions
New in LLM Ops
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for LLM Ops.