I have a setup that other people might find useful. I leave my M2Pro MacMini tucked away always running headless. I use the Tailscale service to assign a “sort of” IP address to the MacMini - in fact, other devices must have TailScale installed and all devices need to be using the same configuration. I have never used TailScale before so it took almost 20 minutes to setup both my Macs, iPad Pro, and my iPhone.
On my MacMini, I always keep running:
OLLAMA_HOST=0.0.0.0 OLLAMA_CONTEXT_LENGTH=32768 ollama serve
Setting a larger than default context length is crucial. For example running Claude Code using a Ollama hosted model fails with a smaller context.
On my MacBook Air I need to set the OLLAMA_HOST address assigned by Tailscale (set the IP address Tailscale gives you, not the ‘dummy’ one I show here):
$ OLLAMA_HOST=100.122.241.16 ollama list
NAME ID SIZE MODIFIED nemotron-3-nano:latest b725f1117407 24 GB 4 weeks ago
devstral-small-2:latest 24277f07f62d 15 GB 4 weeks ago
....
In Python code:
import os, ollama
_remote = os.getenv(”REMOTE_OLLAMA”)
client = ollama.Client(host=_remote) if _remote else ollama
def completion(prompt):
print(f”\n\n$$ completion: prompt: {prompt}\n\n”)
response = client.chat(
model=”rnj-1”,
messages=[{”role”: “user”, “content”: prompt}]
)
ret = response[”message”][”content”]
print(f”\n\n$$ completion: ret: {ret}\n\n”)
return ret
print(completion(”1 + 3”))
I also find it useful to set a shell script for using ollama on the remote MacMini that I call ‘mollama’:
$ cat ~/bin/mollama
#!/usr/bin/env zsh
OLLAMA_HOST= 100.122.241.16:11434 exec ollama “$@”%
$ chmod +x ~/bin/mollama
uv tool install open-webui --python 3.11
Run using:
OLLAMA_HOST=100.122.241.16 open-webui serve
To NOT show OpenAI models, just models on the MacMini with Ollama:
OLLAMA_HOST=100.122.241.16 OPENAI_API_KEY=’’ OPENAI_KEY=’’ open-webui serve
Note, to uninstall use:
uv tool uninstall open-webui
Set these environment variables:
export ANTHROPIC_AUTH_TOKEN=ollama
export ANTHROPIC_BASE_URL=http://100.122.241.16:11434
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
And then create an alias:
alias CLAUDE=’~/.local/bin/claude --model glm-4.7-flash’
The only hassle with my setup is that even though I keep a few SSH sessions open on the remote MacMini, at least twice a week I find that I need to plug the MacMini into a monitor and keyboard/mouse for admin actions that I can’t easily do on the command line.
No posts

Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.