Ollama Command Not Found or Not Recognized? Fix by OS
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.
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.
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 see | Printed by |
|---|---|
zsh: command not found: ollama | zsh, the default shell on macOS |
zsh:1: command not found: ollama | zsh running a script or zsh -c (the form we reproduced, below) |
bash: ollama: command not found | bash, the default shell on most Linux systems |
-bash: ollama: command not found | bash 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 with | Where ollama ends up | What puts it on PATH |
|---|---|---|
macOS app (download or install.sh) | /Applications/Ollama.app/Contents/Resources/ollama, linked from /usr/local/bin/ollama | The 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 Intel | Homebrew'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.exe | The installer appends that folder to your user PATH |
| Docker | Inside the container only | Nothing on the host |
macOS: why is the ollama command missing?
The app only creates the link after you approve it
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:
- Did you pipe the right URL? The install command is
curl -fsSL https://ollama.com/install.sh | sh. Leaving off/install.shpipes the HTML of the Ollama home page intosh, which fails with a syntax error and installs nothing. This one turns up regularly in what people search for. - 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 asudoprompt, a missing tool or a download error. Run it again and read where it stops. - Is bash remembering an old location? If
ollamaused to live somewhere else, bash may have cached that path and now printsbash: /usr/bin/ollama: No such file or directoryinstead. Runhash -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/ollamaimage keeps the program inside the container, so the host shell has noollama. Run commands through the container:docker exec -it ollama ollama list(replace the firstollamawith your container's name). - WSL: a Windows install of Ollama does not give your Linux distro a Linux
ollamacommand. 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.
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:
-
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.
-
Check the folder is on your user PATH:
[Environment]::GetEnvironmentVariable('Path', 'User') -split ';' Test-Path "$env:LOCALAPPDATA\Programs\Ollama\ollama.exe" -
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: "PATHis a list of directories", and Windows appendsollama.exeto 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. -
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 instanceunder the version number, orcould 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 starton 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 appon Windows, orUnable 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'sinstallSymlink) 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 --prefixprints 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
- ollama/ollama v0.40.13:
scripts/install.sh(the LinuxBINDIRchoice and the macOS/usr/local/binlink) app/cmd/app/app_darwin.go(installSymlink, the first-launch link)app/ollama.iss(the Windows install folder and the user PATH entry)- Ollama docs: macOS (the PATH check on startup, custom locations), Linux (install command), Windows (install folder, user PATH,
/DIR) - Homebrew package data: ollama formula and ollama-app cask (read 2 November 2026)
- Issue #16404 (PATH entries must be folders; a stray quote in 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.
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.
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.
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.
Keep going
- PILLARblog/best-ollama-models
- Free Ollama Models (Nov 2026): 10 Best, No API Key
- AI on Steam Deck: Run Local LLMs with Ollama on SteamOS
- Run Hermes Agent Locally with Ollama (2026 Setup Guide)
- Ollama Stuck Loading a Model? Causes and Fixes
- NVIDIA Nemotron 3: Nano, Super & Ultra Specs, Ollama Tags
- Ollama Timed Out Waiting for Server to Start: Fixes
- Could Not Locate Ollama App? Fixes for Windows and Mac
- Can OpenClaw Run on a Local Model? Ollama Setup Tested
- Ollama for Students: Free AI Study Notes & Flashcards
Comments (0)
No comments yet. Be the first to share your thoughts!
