Skip to main content
Copilotbeginner

Fix "zsh: command not found: copilot" — GitHub Copilot CLI

Resolve `zsh: command not found: copilot` and `bash: copilot: command not found` after installing GitHub Copilot CLI. Fix the PATH the install script could not add, npm global bin issues, and the old gh copilot mix-up.

8 min readUpdated August 2026

You installed GitHub Copilot CLI, the installer reported success, and your shell disagrees:

zsh: command not found: copilot
bash: copilot: command not found
copilot : The term 'copilot' is not recognized as the name of a cmdlet,
function, script file, or operable program.

In almost every case the binary is on disk and your PATH does not include the directory it landed in. Here is how to confirm that and fix it.

First: Confirm Which Product You Installed

copilot and gh copilot are two different things, and mixing them up is the single fastest way to chase a non-existent problem.

CommandProductInstall
gh copilot suggestGitHub CLI extension — suggests and explains shell commandsgh extension install github/gh-copilot
copilotStandalone agentic Copilot CLI — reads and edits your reponpm i -g @github/copilot, Homebrew, WinGet, or the install script

If you only installed the extension, copilot will never resolve. Install the standalone CLI, or use gh copilot instead.

Find the Binary

Before changing anything, establish whether the file exists:

ls -l ~/.local/bin/copilot          # install script, non-root
ls -l /usr/local/bin/copilot        # install script run as root, Intel Homebrew
ls -l /opt/homebrew/bin/copilot     # Homebrew on Apple Silicon
ls -l "$(npm config get prefix)/bin/copilot"   # npm install

If one of those exists, this is a PATH problem — go to Fix 1. If none does, the install did not complete — go to Fix 3.

Fix 1: Add the Install Directory to Your PATH

This is the cause behind most reports, and it has a specific reason. The official install script:

curl -fsSL https://gh.io/copilot-install | bash

installs to $HOME/.local/bin for a normal user (or /usr/local/bin when run as root), then offers to add that directory to your shell profile. That offer only appears when the script can read from an interactive terminal. Because you piped it into bash, stdin is the pipe, so the script skips the prompt and merely prints the line you were supposed to add. It scrolls past, and you get command not found on the next command.

Add it yourself:

# zsh (default on macOS)
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

# bash
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

Then verify:

which copilot
copilot --version

If you installed with npm, use your npm prefix instead:

npm config get prefix                       # e.g. /Users/you/.npm-global
echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

Substitute the real path — do not put a command substitution in your shell profile, or every new shell will run npm on startup.

Advertisement

Fix 2: Clear the Shell's Command Cache

If which copilot prints a valid path but running copilot still fails, your shell is using a stale hash table from before the install:

hash -r

Or just open a new terminal window. This one-liner accounts for a surprising share of "I already fixed the PATH and it still doesn't work" cases.

Fix 3: Reinstall With a Method That Manages PATH for You

If the binary is genuinely missing, pick an install method that puts it somewhere already on your PATH.

# macOS / Linux — Homebrew (symlinks into a directory already on PATH)
brew install --cask copilot-cli

# Any platform — npm (requires Node.js 22+)
npm install -g @github/copilot

# Windows
winget install GitHub.Copilot

Two npm-specific failures to watch for:

  • GitHub Copilot CLI: no platform package found. Reinstall with npm install -g @github/copilot to fetch the package for your platform. — the @github/copilot package is a thin loader that spawns a native binary shipped as a separate per-platform package. If that package was skipped (offline install, --omit=optional, a restrictive proxy), the loader has nothing to run. Reinstall with network access.
  • EACCES: permission denied — npm's global prefix is root-owned. Do not use sudo; move the prefix to a directory you own first.

GitHub also documents that an ignore-scripts=true entry in ~/.npmrc can prevent a complete install; in that case run:

npm_config_ignore_scripts=false npm install -g @github/copilot

Windows Specifics

# Confirm where Windows resolves it
where.exe copilot

# If npm-installed, this directory must be on your PATH
echo $env:AppData\npm

After a WinGet install, open a new terminal — the PATH change does not reach shells that were already running. PowerShell 6 or later is required; Windows PowerShell 5.1 is not supported.

Verify the Fix

which copilot        # or: where.exe copilot
copilot --version
copilot help

Then start it and authenticate:

copilot
# then, at the prompt:
/login

Prevent It Coming Back

  • Prefer Homebrew or WinGet — both install into directories that are already on your PATH.
  • If you use the curl install script, run it and then read the last few lines of its output before closing the terminal; that is where the PATH instruction appears.
  • Keep one install method. A Homebrew cask and an npm global install both provide copilot, and whichever appears earlier in your PATH wins — which makes version mismatches very confusing to debug.
  • After changing your shell profile, always open a new terminal to confirm the change persists rather than relying on source.

Next Steps

Frequently Asked Questions

Find answers to common questions

The install script places the binary in $HOME/.local/bin for a non-root install and offers to add that directory to your shell profile — but only when the session is interactive. Piping the script through 'curl ... | bash' makes stdin non-interactive, so it prints the PATH line instead of applying it and most people miss it.

The install script uses $HOME/.local/bin for a normal user and /usr/local/bin when run as root. Homebrew symlinks it into /opt/homebrew/bin (Apple Silicon) or /usr/local/bin (Intel). An npm install puts a loader at your npm global prefix's bin directory.

They are different products. 'gh copilot' is the older GitHub CLI extension for suggesting and explaining shell commands. 'copilot' is the standalone agentic Copilot CLI installed from @github/copilot, the copilot-cli Homebrew cask, WinGet, or the install script. Having the extension does not give you the 'copilot' command.

Append 'export PATH="$HOME/.local/bin:$PATH"' to ~/.zshrc (zsh) or ~/.bashrc (bash), then run 'source ~/.zshrc' or open a new terminal. Verify with 'which copilot'.

zsh caches command locations in a hash table for the life of the shell. Run 'hash -r' (or 'rehash') to clear it, or simply open a new terminal window.

The npm package @github/copilot is a small loader that spawns a per-platform native binary shipped as a separate package. If that platform package was not installed, the loader prints this message. Reinstall with 'npm install -g @github/copilot' so the platform package downloads.

Node.js 22 or later. Check with 'node --version' before installing; an older Node is a common reason the install does not complete cleanly.

Install with 'winget install GitHub.Copilot' and open a new terminal so the updated PATH is picked up. If you installed via npm, confirm %AppData%\npm is on your PATH. PowerShell 6 or later is required.

Run 'which copilot' (or 'where.exe copilot' on Windows) to confirm the resolved path, then 'copilot --version'. If both succeed, run 'copilot' and authenticate with /login.