The Mac terminal does not know the docker command
zsh: command not found: dockerShort answer
The shell cannot find a docker binary in any folder on PATH. Docker Desktop for Mac puts symlinks in $HOME/.docker/bin and expects that folder on PATH. Check that the folder exists, add it to your shell profile, or switch the CLI location to /usr/local/bin in Docker Desktop settings.
Fix it fast
1Find out which cause you have
See whether the binary exists and whether its folder is on PATH.
ls -l ~/.docker/bin echo "$PATH" | tr ':' '\n' | grep -n docker ls /Applications/Docker.app2Match what you see, then jump to its fix
- 1
ls: /Applications/Docker.app: No such file or directoryDocker Desktop is not installedFix - 2
ls -l ~/.docker/bin shows docker, but the PATH listing has no .docker/bin line$HOME/.docker/bin is not on PATHFix - 3
Settings > Advanced shows the CLI tools in the system directory, and /usr/local/bin has no docker linkThe CLI location is set to the system folder but the symlinks are missingFix
- 1
What does the error look like?
zsh: command not found: dockerbash: docker: command not found
Cause 1 of 3
Docker Desktop is not installed
1Check
The Docker binaries live inside the app bundle. If there is no bundle, there is nothing to find.
ls /Applications/Docker.app/Contents/Resources/bin2Fix
Install Docker Desktop for Mac from Docker's download page and open it once so it can finish setting up.
open -a Docker3Verify
The command now resolves.
docker --versionConfirmed by docs.docker.com
Cause 2 of 3
$HOME/.docker/bin is not on PATH
1Check
Docker Desktop creates its symlinks in $HOME/.docker/bin and adds that folder to your PATH. A shell profile that sets PATH from scratch, or one that was never reloaded, removes it again.
grep -n "PATH" ~/.zshrc ~/.zprofile 2>/dev/null2Fix
Add the folder back to PATH in your shell profile, then open a new terminal window.
echo 'export PATH="$HOME/.docker/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc3Verify
which finds the binary in the folder you added.
which dockerConfirmed by docs.docker.com
Cause 3 of 3
The CLI location is set to the system folder but the symlinks are missing
1Check
Docker Desktop can keep the symlinks in /usr/local/bin instead. If that folder is not writable by normal users, it needs authorisation before it creates them.
ls -l /usr/local/bin | grep -i docker2Fix
Open Docker Desktop, go to Settings > Advanced, choose the location for the CLI tools, and approve the prompt if one appears. The user directory option avoids the prompt.
# Docker Desktop > Settings > Advanced > CLI tools location3Verify
Open a new terminal and run the version command.
docker --versionConfirmed by docs.docker.com
How do I stop it coming back?
- Keep PATH edits in one place, ~/.zshrc, and append to PATH instead of replacing it.
- Open Docker Desktop once after every install or major upgrade.
- Do not delete ~/.docker unless you plan to let Docker Desktop recreate it.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Servers
The docker command cannot reach the Docker daemon
Cannot connect to the Docker daemon at unix:///Users/<user>/.docker/run/docker.sock. Is the docker daemon running?
This error means the docker client could not talk to a running daemon.
4 causes, each with a fixServers
ping is missing inside a Docker container
sh: 1: ping: not found
Base images such as ubuntu are minimal, so ping is simply not installed.
2 causes, each with a fixServers
Running ps inside a container says command not found
bash: ps: command not found
Slim Debian and Ubuntu images do not ship the procps package, and ps comes from procps.
2 causes, each with a fixServers
apk cannot find py-pip in an Alpine Docker image
py-pip (no such package):
On current Alpine releases there is no package called py-pip.
2 causes, each with a fixServers
ng serve runs in the container but localhost:4200 does not open
The browser cannot open localhost:4200 although ng serve is running in the container
ng serve listens on localhost by default, which inside a container is the container itself.
3 causes, each with a fixServers
Angular routes return 404 from nginx when you refresh or open a link
The home page loads, but refreshing /some/route shows an nginx 404
Angular routes like /users/42 are not files, so nginx looks for them on disk and returns 404.
3 causes, each with a fix