All tutorials/3 min/Beginner

Ollama tutorial

How to Install and Run the Ollama CLI on Mac and Windows

Step-by-step guide to installing the Ollama CLI on macOS and Windows to run local AI models like Llama 3. Includes exact commands and port troubleshooting.

AI ToolsCLIBeginner
Interactive tutorial

Quick command sequence

$ ollama run llama3

/es/tutorials/install-ollama-cli-local-ai-mac-windows

Interactive command lab

1/4

Step 1

Download the Official Installer

While you can curl it, it's easier to download the official macOS or Windows installer directly from the website. Install it like a normal app.

Checkpoint

Download link

zsh — tutorial-lab

Command tray

$ curl -O https://ollama.com/download/Ollama-darwin.zip

% Total % Received % Xferd Average Speed Time Time Time Current

100 175M 100 175M 0 0 14.2M 0 0:00:12 0:00:12 --:--:-- 15.3M

Step-by-step instructions

  1. 1

    Step

    Download the Official Installer

    While you can curl it, it's easier to download the official macOS or Windows installer directly from the website. Install it like a normal app.

    curl -O https://ollama.com/download/Ollama-darwin.zip
  2. 2

    Step

    Verify the Ollama Service

    If you get 'command not found', ensure you have launched the Ollama app from your Applications/Start menu first.

    ollama --version
  3. 3

    Step

    Run Your First Local Model

    The first time you run a model, Ollama downloads the multi-gigabyte weights. Future runs will start instantly.

    ollama run llama3
  4. 4

    Step

    List Installed Models

    You can remove models you no longer need using the 'ollama rm' command (e.g., ollama rm llama3) to free up space.

    ollama list

Why this matters

Running large language models (LLMs) locally protects your data privacy, works completely offline, and saves you money on API costs. The Ollama CLI takes away the headache of managing Python environments, C++ compilers, and GPU drivers. It packages the model weights, execution engine, and REST API into one simple command-line interface.

Troubleshooting

  • **'Error: could not connect to ollama app':** The CLI is just a client. The background Ollama service must be running. Check your Mac menu bar or Windows system tray. If it's not there, launch the Ollama app manually from your Applications or Start menu.
  • **Port 11434 conflicts:** By default, Ollama binds to `localhost:11434`. If another app uses this port, you can change it by setting the `OLLAMA_HOST` environment variable (e.g., `export OLLAMA_HOST=127.0.0.1:11435`) before launching the service.
  • **Slow inference speeds:** Ollama automatically detects and uses your GPU (Apple Silicon or NVIDIA/AMD). If it's running incredibly slow, it might be falling back to CPU mode. Ensure your graphics drivers are up to date, especially on Windows.

FAQ

How do I install Ollama on Windows?

Go to ollama.com/download and select the Windows preview. Download the `.exe` installer, run it, and follow the setup wizard. Once finished, you can use the `ollama` command in PowerShell or Command Prompt.

Can I run Ollama on a Mac without an M-series Apple Silicon chip?

Yes, Ollama supports older Intel-based Macs. However, inference will run entirely on the CPU and will be significantly slower than on Apple Silicon (M1/M2/M3) machines, which use unified memory architecture.

How do I stop the Ollama server?

On Mac, click the Ollama alpaca icon in your top menu bar and select 'Quit'. On Windows, right-click the icon in your system tray (bottom right) and select 'Quit'.

What port does the Ollama API use?

Ollama automatically starts a local REST API server on port 11434. You can send JSON requests to `http://localhost:11434/api/generate` to interact with it programmatically.

How do I update Ollama to the latest version?

When an update is available, the Ollama app usually prompts you with an update notification in your OS tray or menu bar. Alternatively, just download and run the latest installer from the website to overwrite your current version.

Related tutorials