If you get a 403 error when connecting Ollama, set the environment variable OLLAMA_ORIGINS="*".
Linux
Temporary (current terminal session only):
- Open the terminal.
- Enter:
export OLLAMA_ORIGINS="*".
- Run
ollama serve.
Permanent (the variable is set automatically):
For bash:
- Open the terminal.
- Enter:
echo 'export OLLAMA_ORIGINS="*"' >> ~/.bashrc.
- Enter:
source ~/.bashrc.
- Run
ollama serve.
For zsh:
- Open the terminal.
- Enter:
echo 'export OLLAMA_ORIGINS="*"' >> ~/.zshrc.
- Enter:
source ~/.zshrc.
- Run
ollama serve.
macOS
Temporary (current terminal session only):
- Open the terminal.
- Enter:
export OLLAMA_ORIGINS="*".
- Run
ollama serve.
Permanent (macOS uses zsh by default):
- Open the terminal.
- Enter:
echo 'export OLLAMA_ORIGINS="*"' >> ~/.zshrc.
- Enter:
source ~/.zshrc.
- Run
ollama serve.
Windows (PowerShell)
Temporary (current PowerShell only):
- Open PowerShell.
- Enter:
$env:OLLAMA_ORIGINS="*".
- Run
ollama serve.
Permanent (saved to the user environment variables):
- Open PowerShell.
- Enter:
setx OLLAMA_ORIGINS "*".
- Close PowerShell.
- Run
ollama serve.