★ Reading this for free? Get 25 structured AI courses + per-chapter AI tutor — the first chapter of every course free, no card.Start free in 30 secondsOr own every course: $149 once
Ollama

Ollama Command Not Found or Not Recognized? Fix by OS

November 2, 2026
9 min read
Barsha Mohapatra

Want to go deeper than this article?

Free account unlocks the first chapter of all 25 courses — RAG, agents, MCP, voice AI, MLOps, real GitHub repos.

📚AI Learning Path

Ollama’s running. Here’s what to build with it. Go from “ollama run” to RAG apps, agents, and fine-tuned models — structured and hands-on. First chapter free.

Start free
Or own it for life — Lifetime $149, pay once

This error does not come from Ollama. It comes from your shell, and it means the shell searched every folder on your PATH and found no program called ollama. Either Ollama is not installed where you think it is, or its folder is not on this terminal's PATH. The most common case by far: the terminal was opened before the installer changed PATH. Close it, open a new one and try again. If that does not fix it, look in the right place for your installer. The macOS app only creates /usr/local/bin/ollama after you approve a password prompt on first launch. Homebrew puts it in /opt/homebrew/bin on Apple Silicon. The Linux script installs to /usr/local/bin. The Windows installer adds %LOCALAPPDATA%\Programs\Ollama to your user PATH.

Everything below was read from ollama/ollama at tag v0.40.13 (released 28 October 2026), from Ollama's macOS, Linux and Windows docs, and from Homebrew's package data.

Which message is yours?

Each shell words it differently, but they all mean the same thing. Ollama never ran, so nothing Ollama logs will help. The fix is about where the program is and what your shell can see.

What you seePrinted by
zsh: command not found: ollamazsh, the default shell on macOS
zsh:1: command not found: ollamazsh running a script or zsh -c (the form we reproduced, below)
bash: ollama: command not foundbash, the default shell on most Linux systems
-bash: ollama: command not foundbash as a login shell, for example over SSH
'ollama' is not recognized as an internal or external command, operable program or batch file.Windows Command Prompt (cmd.exe)
ollama : The term 'ollama' is not recognized as the name of a cmdlet, function, script file, or operable program.Windows PowerShell 5.1
ollama: The term 'ollama' is not recognized as a name of a cmdlet, function, script file, or executable program.PowerShell 7

We reproduced the zsh form on macOS. Ollama is installed there through Homebrew, at /opt/homebrew/bin/ollama. Starting a shell whose PATH leaves out that folder gives:

$ env -i PATH=/usr/bin:/bin zsh -f -c 'ollama --version'
zsh:1: command not found: ollama

with exit code 127, the shell's "not found" code. Nothing about the install changed between that and a working command. Only PATH did. That is the whole problem in miniature.

Reading articles is good. Building is better.

Free account = the first chapter of all 25 courses, with a per-chapter AI tutor. No card.

Step 1: is the program on disk at all?

Look for the file in the places installers put it. If it is there, you have a PATH problem. If it is not, you have an install problem.

# macOS
ls -l /usr/local/bin/ollama /opt/homebrew/bin/ollama /Applications/Ollama.app/Contents/Resources/ollama 2>/dev/null
echo "$PATH" | tr ':' '\n'

# Linux
ls -l /usr/local/bin/ollama /usr/bin/ollama /bin/ollama 2>/dev/null
echo "$PATH" | tr ':' '\n'
# Windows (PowerShell)
Test-Path "$env:LOCALAPPDATA\Programs\Ollama\ollama.exe"
where.exe ollama
Installed withWhere ollama ends upWhat puts it on PATH
macOS app (download or install.sh)/Applications/Ollama.app/Contents/Resources/ollama, linked from /usr/local/bin/ollamaThe link, created after an admin prompt
Homebrew (brew install ollama or the ollama-app cask)$(brew --prefix)/bin/ollama: /opt/homebrew/bin on Apple Silicon, /usr/local/bin on IntelHomebrew's shell setup line
Linux install.sh/usr/local/bin/ollama (or /usr/bin, see below)Already on PATH when the script runs
Windows OllamaSetup.exe%LOCALAPPDATA%\Programs\Ollama\ollama.exeThe installer appends that folder to your user PATH
DockerInside the container onlyNothing on the host

macOS: why is the ollama command missing?

Dragging Ollama.app into Applications does not put ollama on your PATH. The app does that the first time it runs, and only if you let it. Ollama's macOS docs say: "Upon startup, the Ollama app will verify the ollama CLI is present in your PATH, and if not detected, will prompt for permission to create a link in /usr/local/bin." In the source, installSymlink checks whether the ollama on your PATH already points at the app's CLI. If it does not, it asks for administrator authorization and creates /usr/local/bin/ollama, making /usr/local/bin first if it does not exist.

So you get "command not found" if you never opened the app after copying it, or if you cancelled the password prompt. Open the app once and approve the prompt, or create the link yourself. This is the same command the install script runs:

sudo mkdir -p /usr/local/bin
sudo ln -sf /Applications/Ollama.app/Contents/Resources/ollama /usr/local/bin/ollama
rehash          # zsh: forget the earlier "not found"
ollama --version

If you keep the app somewhere other than /Applications, point the link at the Contents/Resources/ollama inside that copy. Ollama's macOS docs allow a custom location as long as that CLI, or a link to it, is on your PATH.

Homebrew installs it, but your shell does not know about Homebrew

Both Homebrew packages, the ollama formula and the ollama-app cask, link ollama into Homebrew's own bin folder. On Apple Silicon Macs that is /opt/homebrew/bin, which macOS does not put on PATH by itself. If brew is also "command not found", Homebrew's setup line is missing from your shell profile:

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
exec zsh -l
ollama --version

That is the line Homebrew's own installer tells you to add at the end of its install. On Intel Macs Homebrew uses /usr/local, which is already on PATH, so this case is mostly an Apple Silicon one.

It works in Terminal but not in a script, cron job or another app

Programs that are not started from your terminal do not read your shell profile, so they get a short default PATH. That is exactly what our env -i reproduction above does on purpose. In scripts, launch agents and app settings, use the full path: /usr/local/bin/ollama for the app, or /opt/homebrew/bin/ollama for Homebrew on Apple Silicon.

Linux: why is ollama not found after the install script?

The script installs into a folder that is already on your PATH, so if ollama is missing right afterwards, the install almost certainly did not finish. This is how scripts/install.sh chooses where to put it:

for BINDIR in /usr/local/bin /usr/bin /bin; do
    echo $PATH | grep -q $BINDIR && break || continue
done
OLLAMA_INSTALL_DIR=$(dirname ${BINDIR})

It takes the first of /usr/local/bin, /usr/bin and /bin that appears in your PATH, and installs there. On a normal system that is /usr/local/bin/ollama, with the libraries in /usr/local/lib/ollama. So check these, in order:

  1. Did you pipe the right URL? The install command is curl -fsSL https://ollama.com/install.sh | sh. Leaving off /install.sh pipes the HTML of the Ollama home page into sh, which fails with a syntax error and installs nothing. This one turns up regularly in what people search for.
  2. Did the binary step finish? The script only arms its success message after the program is in place, so a run that got that far ends with >>> Install complete. Run "ollama" from the command line. If you never saw that line, it stopped earlier, usually at a sudo prompt, a missing tool or a download error. Run it again and read where it stops.
  3. Is bash remembering an old location? If ollama used to live somewhere else, bash may have cached that path and now prints bash: /usr/bin/ollama: No such file or directory instead. Run hash -r, or open a new shell.
curl -fsSL https://ollama.com/install.sh | sh
hash -r
command -v ollama && ollama --version
systemctl status ollama --no-pager

Docker and WSL

  • Docker: the ollama/ollama image keeps the program inside the container, so the host shell has no ollama. Run commands through the container: docker exec -it ollama ollama list (replace the first ollama with your container's name).
  • WSL: a Windows install of Ollama does not give your Linux distro a Linux ollama command. Install the Linux build inside the distro with the script above, or keep using the Windows server from WSL over the network, which our connection refused guide covers in its WSL2 section.
Own it instead of renting it

Run this on your own machine and stop paying every month

Pay once and keep it. No renewal, no per-token bill, and nothing you feed it ever leaves your hardware.

Windows: why is 'ollama' not recognized?

The installer adds %LOCALAPPDATA%\Programs\Ollama to your user PATH, and only terminals opened after that change can see it. The installer script, app/ollama.iss, installs to {localappdata}\Programs\Ollama and adds a registry entry that appends that folder to HKCU\Environment\Path, if it is not already there. Ollama's Windows docs say the same: that folder "contains the binaries (The installer adds this to your user PATH)".

Work down this list:

  1. Open a new terminal. A program keeps the environment it started with. A Command Prompt, PowerShell or editor terminal (VS Code included) opened before the install will not see the new PATH until you close it and start a new one. Some terminal apps keep the old environment for new tabs, so close the whole app.

  2. Check the folder is on your user PATH:

    [Environment]::GetEnvironmentVariable('Path', 'User') -split ';'
    Test-Path "$env:LOCALAPPDATA\Programs\Ollama\ollama.exe"
    
  3. Check PATH is not broken. A stray quotation mark in PATH stops every entry after it from working. An entry that names a file instead of a folder (...\Ollama\ollama.exe) never works. An Ollama collaborator explained the second one in issue #16404: "PATH is a list of directories", and Windows appends ollama.exe to each entry while it searches. A broken PATH also stops the tray app from starting its server. The commands to find the bad entry are in Ollama timed out waiting for server to start.

  4. Custom install folder. If you installed with OllamaSetup.exe /DIR="d:\some\location", that folder is the one that has to be on PATH.

To use Ollama right now in the current PowerShell window, add the folder for this session only:

$env:Path += ";$env:LOCALAPPDATA\Programs\Ollama"
ollama --version

To add it permanently to your user PATH, use Settings (search "environment variables", then "Edit environment variables for your account"), or PowerShell. Copy your current PATH somewhere first, because a bad edit affects every program:

$user = [Environment]::GetEnvironmentVariable('Path', 'User')
[Environment]::SetEnvironmentVariable('Path', "$user;$env:LOCALAPPDATA\Programs\Ollama", 'User')

Or skip PATH entirely and call it by its full path: & "$env:LOCALAPPDATA\Programs\Ollama\ollama.exe" list. The rest of the Windows install is covered in Ollama on Windows.

Found it. What comes next?

Once ollama --version prints a version, the shell problem is over, and any new error comes from Ollama itself. The usual next one is that no server is running:

  • Warning: could not connect to a running Ollama instance under the version number, or could not connect to ollama server, run 'ollama serve' to start it: start the server. See connection refused on port 11434.
  • Error: timed out waiting for server to start on macOS or Windows: the CLI launched the app and it did not answer within 5 seconds. See timed out waiting for server to start.
  • Error: could not locate ollama app on Windows, or Unable to find application named 'Ollama' on macOS: see could not locate ollama app.

If this is a brand-new install, 15 first-time Ollama setup mistakes covers what tends to go wrong after that.

Honest limitations

  • We reproduced only the zsh message, on macOS, by starting a shell without Homebrew's folder on PATH. The bash, Command Prompt and PowerShell lines are the standard messages those shells print, quoted in the exact form people search for. We did not reproduce them.
  • Installer behaviour is read from the source at v0.40.13 (install.sh, ollama.iss, the macOS app's installSymlink) and from Ollama's install docs. A later installer could choose different folders.
  • Homebrew folders are Homebrew's defaults. A custom Homebrew prefix moves them. brew --prefix prints yours.
  • We do not list "reinstall" as a first step. Most of these cases are a terminal that started before the install, and reinstalling does not change that terminal.

FAQ

Why does ollama work in one terminal but not another?

Because each terminal has the PATH it started with. A window opened before the install (or before you edited PATH) keeps the old value until you close it. On macOS, a shell that does not read your profile, such as a script or cron job, gets a shorter PATH that may not include /opt/homebrew/bin or /usr/local/bin.

Do I need to restart Windows after installing Ollama?

Usually not. A new terminal window picks up the PATH the installer added. Signing out and back in is only needed if some long-running program, such as an editor that launches terminals, keeps handing out its old environment.

Where is ollama installed on Mac, Linux and Windows?

macOS app: /Applications/Ollama.app/Contents/Resources/ollama, linked from /usr/local/bin/ollama. Homebrew: $(brew --prefix)/bin/ollama. Linux script: /usr/local/bin/ollama, with libraries in /usr/local/lib/ollama. Windows: %LOCALAPPDATA%\Programs\Ollama\ollama.exe. Models live elsewhere, set by OLLAMA_MODELS.

Why is ollama not recognized in the VS Code terminal?

VS Code's terminal inherits the environment VS Code started with. If VS Code was open while you installed Ollama, quit it completely and start it again so new terminals get the updated PATH.

Can I run ollama without adding it to PATH?

Yes. Call it by its full path: /usr/local/bin/ollama list on macOS or Linux, or & "$env:LOCALAPPDATA\Programs\Ollama\ollama.exe" list in PowerShell. Apps that talk to Ollama over its API on port 11434 do not need the command on PATH at all, only a running server.

Is "ollama: command not found" on a server the same thing?

Yes, plus one more case: over SSH you get a login shell (-bash: ollama: command not found), which reads a different profile than a desktop terminal. If the install script ran as a different user with a different PATH, check ls -l /usr/local/bin/ollama and that user's PATH.

Other Ollama errors: every error string, indexed · could not locate ollama app · timed out waiting for server to start · connection refused on 11434

Sources

🎯
AI Learning Path

Ollama’s running. Here’s what to build with it.

Go from “ollama run” to RAG apps, agents, and fine-tuned models — structured and hands-on. First chapter free.

Or own it for life — Lifetime $149 $599, pay once
Once your hardware is sorted

Stop piecing Ollama together from blog posts

Ollama Mastery is 15 chapters end to end — install, model choice, Modelfiles, GPU offload, the API, and the 20 errors that actually happen. Plus 24 more courses.

$149 once unlocks everything, forever — about $0.27/chapter for life. Prefer to spread it out? Pro is $79/year (saves 27%) or $8.99/month.
Secure checkout by Lemon Squeezy — your card never touches this siteInstant access the moment you payFirst chapter of every course is free — try before you buy

Liked this? 25 full AI courses are waiting.

From fundamentals to RAG, agents, MCP servers, voice AI, and production deployment with real GitHub repos. First chapter free, every course.

Reading now
Join the discussion
TagsOllamaTroubleshootingInstallationWindowsmacOSLinux

Barsha Mohapatra

Local AI Master writes hands-on courses and hardware guides for running AI on machines you own. Content is checked against current releases and corrected when readers tell us it is wrong.

Build Real AI on Your Machine

RAG, agents, NLP, vision, and MLOps - chapters across 25 courses that take you from reading about AI to building AI.

Want the structured version?

Hands-on courses on local AI, from $8.99 a month. The first chapter of each is free.

AI Learning Path
More on Ollama
See the full Best Ollama Models 2026 guide.

Comments (0)

No comments yet. Be the first to share your thoughts!

📅 Published: November 2, 2026🔄 Last Updated: November 2, 2026✓ Manually Reviewed

Ready to Go Beyond Tutorials?

25 structured courses with hands-on chapters - build RAG chatbots, AI agents, and ML pipelines on your own hardware.

🎯
AI Learning Path

Go from reading about AI to building with AI

25 structured courses. Hands-on projects. Runs on your machine. Start free.

Or own it for life — Lifetime $149 $599, pay once

Was this helpful?

Barsha Mohapatra

Written by

Barsha Mohapatra

Founder and Editor, Local AI Master · Founder, Little AI Master

Founder of Little AI Master and the editor behind every course and guide on Local AI Master. Years of tutoring students taught her where AI education actually fails.

📚
Free · no account required

Grab the AI Starter Kit — career roadmap, cheat sheet, setup guide

No spam. Unsubscribe with one click.

🎯
AI Learning Path

Ollama’s running. Here’s what to build with it.

Go from “ollama run” to RAG apps, agents, and fine-tuned models — structured and hands-on. First chapter free.

Or own it for life — Lifetime $149 $599, pay once
Free Tools & Calculators