python: command not found on Mac: try python3 first, do not patch /usr/bin
Frank Zhang
- 5 minutes read - 2095 wordsTL;DR
This error means the current shell has no command named python on PATH. On recent macOS that is often because the system no longer ships Python 2 as python, not because Python is completely absent. General guidance, not a first-hand session.
Treat these as two different facts: the current shell cannot find a command named python, and the Mac may still have a usable Python 3. In Terminal, read python3 first. If python3 --version prints a version, use python3 (and python3 -m pip when you need a package installer). Do not start by changing /usr/bin, and do not install Python 2 to satisfy an old tutorial. If python3 is also missing, install a supported runtime and confirm the new command is on PATH. This page is general guidance, not a record of one session. The commands were not re-run for this page. There is no first-hand screenshot of the error. The sources are the official Python documentation, Apple’s Xcode 11 release notes, and Homebrew formula caveats, as read on 2026-12-02. If those docs, python3 --version, which -a python3, or the text on your screen disagree, trust the copy in front of you.
People often paste a line like this after they type python in Terminal, following a tutorial:
zsh: command not found: python
In bash the same miss usually looks like bash: python: command not found. Some people then try python3 and get python3: command not found. Those are two branches. Do not fix them as if they were the same failure.
Which messages this page is for
This page is for python: command not found, zsh: command not found: python, and the common autocomplete forms python command not found mac / macos / mac terminal / mac vscode / mac after install, plus python command not found but python3 works and python3 command not found mac. On 2026-12-02, the en-US Google suggestions for python command not found mac listed 10 queries (including macos, terminal, vscode, macbook, after install, python3, py, not working / not recognized). The same English root in zh-CN Google also listed 10, including but python3 works, after install, pyenv, sudo python, and bash. The shorter root python command not found also listed 10 zh-CN Google suggestions, including but python3 works, vscode, python3, and zsh. Bing, in both markets, also suggested forms such as mac zsh command not found python and python3 command not found.
This page is not for:
zsh: command not found: brew. That is Homebrew missing fromPATH; see zsh: command not found: brew on Mac: check the prefix, then fix PATH.- A global CLI that already runs in your terminal, but an AI agent, a script, or a non-interactive shell prints
command not found. That is a Node prefix / interactive-versus-non-interactive mismatch; see command not found after npm install -g: your terminal and the AI agent are using different Node installs. xcrun: error: invalid active developer pathafter a macOS update. See xcrun: invalid active developer path after a macOS update (missing xcrun). If you are installing Command Line Tools so that the systempython3can run, this page will point there, but it still treats the missingpython/python3command, not that xcrun error.- The same words on Linux or Windows. The paths and installers are different. Do not copy the Mac locations below onto those systems.
- A standalone
pip: command not founddeep dive. Ifpython3already works, trypython3 -m pipfirst. This page does not troubleshoot pip on its own.
Why python is often missing on a current Mac
The Xcode 11 Release Notes, as read on 2026-12-02, say in the deprecations section that scripting language runtimes such as Python, Ruby, and Perl were included in macOS for compatibility with legacy software, and that in future versions of macOS those runtimes won’t be available by default, and may require you to install an additional package. The same paragraph says use of Python 2.7 isn’t recommended. That version was still included for legacy compatibility, but future versions of macOS would not include Python 2.7; Apple recommended running python3 in Terminal instead.
That is a good explanation for a very common surprise: tutorials still type python, and a newer Mac prints command not found. It does not prove that your Mac has no Python 3 at all, and it is not evidence that Python is “broken” and should be uninstalled first.
Using Python on macOS, read the same day, says that recent versions of macOS include a python3 command at /usr/bin/python3 that links to a usually older and incomplete version of Python provided by and for use by the Apple development tools, Xcode or the Command Line Tools for Xcode. You should never modify or attempt to delete this installation, as it is Apple-controlled and is used by Apple-provided or third-party software. If you also install a newer Python from python.org, the two installations can co-exist; the default installer options should ensure that its python3 is used instead of the system python3.
So the first step, when python is missing, is to see whether python3 is already there — not to patch /usr/bin.
Read-only first: python and python3 are not the same command
In Terminal, start with read-only commands:
command -v python
command -v python3
type -a python
type -a python3
which -a python
which -a python3
ls -l /usr/bin/python /usr/bin/python3
python3 --version
echo "$PATH"
No output from command -v / which, or No such file or directory from ls, is still a useful result. Do not skip it. Even if /usr/bin/python3 exists, that does not mean you already have a complete Python 3 for everyday development: the official docs call it usually older and incomplete. If running /usr/bin/python3 prompts you to install the Command Line Tools, that matches the official install page: on a fresh macOS install, invoking a command from that package prompts you to download and install it. Follow that prompt, or run xcode-select --install. Do not delete the developer directory first. For the invalid-developer-path case, see xcrun: invalid active developer path after a macOS update (missing xcrun).
Use the output to pick one of the three branches below.
1. python is missing, but python3 prints a version
This is the common autocomplete form python command not found but python3 works. The current shell has no command named python, but a usable Python 3 is already there. In the tutorial, type python3 instead of python, and python3 -m pip instead of pip. Do not change or overwrite files under /usr/bin just to make the word python work.
If a script hard-codes #!/usr/bin/env python or #!/usr/bin/python, prefer changing the script so it calls python3. Do not treat an interactive-shell alias as a fix that will also apply to scripts, sudo, VS Code tasks, or CI. Those environments often never read your interactive aliases.
If you installed Python with Homebrew, the python@3.15 formula caveat as read on 2026-12-02 says this formula installs Python as $HOMEBREW_PREFIX/bin/python3, while unversioned symlinks such as python and pip are installed into $HOMEBREW_PREFIX/opt/python@3.15/libexec/bin. The python@3.14 formula page, read the same day, also notes that if you do not need a specific version and always want Homebrew’s python3 on PATH, you should install the default python3 formula. Which version is the default will change; do not copy 3.15 or 3.14 into a config file. Only if you truly need the name python, and you already installed the matching Homebrew formula, should you consider adding that libexec/bin directory to your own PATH, following the caveat on your machine. Trust brew --prefix and brew info on that Mac.
2. python3 is missing too
The current environment has no usable python3. Do not assume there is only one correct installer. Common official options include:
- Command Line Tools for Xcode. Installing the command-line tools, read on 2026-12-02, says you can install them with
xcode-select --install. If Xcode is already installed, you do not need a separate Command Line Tools package. After the install finishes, open a new terminal window and re-run the read-only commands to see whether/usr/bin/python3prints a version. Remember: this is the Apple-provided, usually older and incomplete runtime for Apple’s developer tools. It is a reasonable way to get apython3command to appear. For day-to-day development, Using Python on macOS leans toward installing your own runtime as well. - The python.org macOS installer. The same document says a default install places a framework at
/Library/Frameworks/Python.framework, puts symlinks in/usr/local/bin/, and adds that location to your shell path. After the installer finishes, it also tells you to double-clickInstall Certificates.commandin the/Applications/Python 3.x/window so that this Python gets SSL root certificates. Use the version you actually downloaded, not a version number copied from a screenshot. The packaged builds are listed at Python Releases for macOS. - Homebrew. The official Python docs list Homebrew as one third-party distribution on macOS. If you already use Homebrew, install
python3as the formula docs describe. Ifbrewitself is missing, follow zsh: command not found: brew on Mac: check the prefix, then fix PATH first. Do not try to fix PATH and Python in one pass on this page.
This page will not pick pyenv, asdf, or another version manager for you, and it does not claim that one installer is right for every project. If the autocomplete form pyenv python command not found matches your setup, follow that project’s own init docs and check whether its shims are on the current shell. Do not apply the system-path changes below to a version manager.
3. You already installed Python, and the shell still says command not found
Autocomplete also includes python command not found mac after install. Re-run the read-only commands. Confirm where the installer placed the executable, and whether the current PATH includes that bin directory. The python.org installer documentation names /usr/local/bin/. Homebrew uses bin under its default prefix (commonly /opt/homebrew/bin on Apple Silicon, and /usr/local/bin on Intel). If the file is there but the current window’s PATH does not include it, the new shell config often has not been loaded yet. Open a new terminal window and try again. For PATH and shellenv, see zsh: command not found: brew on Mac: check the prefix, then fix PATH.
A terminal or task inside Visual Studio Code, or another editor, may not use the same PATH or the same interpreter as the system Terminal app. The 2026-12-02 English and Chinese suggestion lists both included mac vscode. In system Terminal, take the path from which -a python3, then select that same interpreter in the editor. Do not change system directories in the hope that every app will line up.
sudo python missing is also not proof that the Mac has no Python. sudo often uses its own PATH (a secure path) that may omit the Homebrew prefix or /usr/local/bin. Start with command -v python3 without sudo. This page does not treat “change sudo’s PATH” or “install Python with sudo” as the fix.
The py launcher common on Windows is not a default macOS command. The autocomplete form py command not found mac does not mean your Mac should already have py. Unless you installed a tool that provides it, do not treat that line as the main Mac path.
What not to do first
- Do not modify, overwrite, or delete
/usr/bin/python3. The official Python docs say you should never modify or attempt to delete this Apple-controlled installation. - Do not use
sudo ln -sfto plant apythonname under/usr/binas a “fix” for this error. - Do not install Python 2.7 just to match an old tutorial. Apple’s release notes already recommend against it, and say future systems would not include it.
- Do not uninstall and reinstall first, as if a missing command were a corrupted install. Read
command -v/which -aandPATHfirst. - Do not treat Terminal, VS Code,
sudo, and CI as one environment and change them together.
Where this page stops
- The commands were not re-run on a Mac for this page. There is no first-hand screenshot. The sources are the official documents dated above.
- This page does not choose a Python 3 minor version for you, and it does not cover virtual environments, conda, or lockfiles.
- It does not promise that a non-interactive script, a VS Code task, or
sudowill find the same interpreter after you install one for your own shell. - Search volume. This page did not collect a separate keyword-volume dataset. Autocomplete only shows that people search for these phrasings; it is not verified search volume.
For the rest of the reading path, see Start here. The Chinese page is a separate write-up of the same topic: python: command not found:Mac 上先试 python3,不要先改系统路径.
If this post helps, you can sponsor the blog. This is voluntary personal support, not a charitable donation.