If you encounter Error: listen tcp 127.0.0.1:11434: bind: address already in use
, follow the steps below to resolve the issue.
lsof -ti:11434
This will show the process IDs (PIDs) using port 11434.
# Kill specific processes (replace PID with actual process ID from Step 1)
kill -9 [PID]
# Or kill all Ollama processes at once
pkill -f ollama
The Ollama desktop app may automatically restart the service. Try:
# Quit the Ollama application entirely
osascript -e 'quit app "Ollama"'
# Or force quit if the above doesn't work
pkill -f "Ollama.app"
# Kill Ollama processes
taskkill /F /IM ollama.exe
# Or stop the Ollama service
net stop ollama
# Kill all Ollama processes
pkill -f ollama
# Or stop systemd service if applicable
sudo systemctl stop ollama
lsof -ti:11434
This should return nothing if the port is free.
# Using custom start script
./start-ollama.sh
# Or start directly
ollama serve
# Or start with specific configuration
OLLAMA_ORIGINS="chrome-extension://*,http://localhost:*,https://localhost:*" ollama serve
ollama --help # Check available Ollama commands
ollama ps # List running Ollama models
pkill ollama # Attempt to kill Ollama processes
lsof -ti:11434 # Find processes using port 11434
kill -9 [PID] # Force kill specific processes
pkill -f ollama # Kill all processes matching "ollama"
ps aux | grep ollama # List all Ollama-related processes
If Ollama keeps restarting automatically:
systemctl list-unit-files | grep ollama
Sometimes multiple Ollama instances can run simultaneously:
ps aux | grep ollama
Use this to see all running instances and kill them individually.
You can configure Ollama to use a different port:
# Set custom port
export OLLAMA_HOST=127.0.0.1:11435
ollama serve
# Or with full configuration
OLLAMA_HOST=127.0.0.1:11435 OLLAMA_ORIGINS="chrome-extension://*" ollama serve
Error | Cause | Solution |
---|---|---|
bind: address already in use |
Port 11434 is occupied | Follow steps 1-5 above |
connection refused |
Ollama not running | Start Ollama with ollama serve |
403 Forbidden |
CORS issues | Start with OLLAMA_ORIGINS environment variable |
CORS (Cross-Origin Resource Sharing) is a security feature built into web browsers to protect users from malicious websites.
By default, web browsers prevent websites and extensions from accessing software running on your computer. This is a security feature, not a bug. Here's why:
Bookmark GPT Pro needs to communicate with Ollama (running on your computer) to provide AI features. Since this crosses the security boundary between "web content" and "local software," we need to explicitly tell Ollama to allow this connection.
When you start Ollama with OLLAMA_ORIGINS="chrome-extension://*"
, you're essentially telling Ollama: "It's okay to accept requests from Chrome extensions, I trust them."
This is safe because:
In most cases, the key issue is that the Ollama desktop application automatically restarts the service even after killing individual processes. This is why you need to quit the application itself using the methods in Step 3.
For browser extensions and web applications, make sure to set:
export OLLAMA_ORIGINS="chrome-extension://*,http://localhost:*,https://localhost:*"
export OLLAMA_HOST="127.0.0.1:11434"
Then start Ollama:
ollama serve
ollama stop [model-name]
before shutting downlsof -ti:11434
to check if the port is free before starting Ollama