Ollama Server Management

Manage the Ollama background service across Linux, macOS, and Windows, and read its logs to debug crashes.

TL;DR

  1. Ollama runs as a background daemon on port 11434.
  2. Restart the Linux service with systemctl restart ollama.
  3. Read server.log to debug silent memory crashes and stalls.

The Background Daemon

    ollama serve

    Start the API server in the foreground for manual runs.

    ollama serve
    # listens on 127.0.0.1:11434
    Default Port

    A quick request to the root path confirms it is up.

    curl http://localhost:11434
    # Ollama is running
    ollama ps

    List models the running server currently holds in memory.

    ollama ps
    Health Check

    List available models to verify the API responds.

    curl http://localhost:11434/api/tags

Linux (systemd)

    Check Status

    Show whether the service is active and any recent errors.

    systemctl status ollama
    Restart

    Restart the service to apply new settings or recover.

    sudo systemctl restart ollama
    Edit Service

    Open an override file to add environment variables.

    sudo systemctl edit ollama.service
    View Logs

    Follow the service journal live to watch for errors.

    journalctl -u ollama -f

macOS And Windows

    Restart App

    Quit from the menu bar or tray, then relaunch Ollama.

    # Quit and reopen the Ollama app
    macOS Env Var

    Set a variable for the app, then restart Ollama.

    launchctl setenv OLLAMA_HOST 0.0.0.0:11434
    macOS Logs

    Read the server log written to your home directory.

    cat ~/.ollama/logs/server.log
    Windows Logs

    Open the log folder under your local app data.

    %LOCALAPPDATA%\Ollama\server.log

Debugging

    Enable Debug

    Start with verbose logging to trace load failures.

    OLLAMA_DEBUG=1 ollama serve
    Port In Use

    Find what already holds port 11434 before restarting.

    lsof -i :11434
    Memory Errors

    Search the journal for out-of-memory crash lines.

    journalctl -u ollama | grep -i memory
    Verify Env

    Print the environment the running service actually sees.

    cat /proc/$(pgrep ollama)/environ |
      tr '\0' '\n' | grep OLLAMA

Tips

  1. On Linux, run systemctl status ollama before restarting, so you can read recent errors and confirm the service is actually running.
  2. Set OLLAMA_DEBUG=1 and restart the server to log detailed GPU and model-loading information when something fails.

Warnings

  1. Variables in your shell profile are not read by the systemd service; set them with systemctl edit ollama.service instead.
  2. The server holds port 11434 open, so a second ollama serve fails with an address-already-in-use error.

In Practice

FAQ