As suggested by the Homebrew (executable brew) installer itself, be sure to add this to your .bashrc file or .zshrc file:

export PATH="/usr/local/opt/python/libexec/bin:$PATH"
Answer from Pamput on Stack Overflow
🌐
Homebrew
docs.brew.sh › Language-Runtimes-and-Packages
Homebrew Documentation: Language Runtimes and Packages
The default formula installs python3 and pip3 into Homebrew’s bin directory. Unversioned names such as python, python-config and pip are installed into: ... Add that directory to PATH only when unversioned command names are required.
Discussions

Fresh Apple M1 install of homebrew and python, need to update path?
Sorry for the noob question. I just installed homebrew (arm native install) with no issues. I then installed python via "brew install python" (3.9.1) and again no issues. I see the bins a... More on github.com
🌐 github.com
1
3
January 7, 2021
Installed Homebrew in Terminal (OSX 10.11.4), confused on how to "insert the Homebrew directory at the top of your PATH environment variable."
PATH is your system path . When you run programs from the command line, the operating system uses PATH as a list of directories where the program might be located. These directories are separated in the list with colons (:). There are a few default locations that the os looks for executable files (you can see them if you run echo $PATH from the command line). However, some user installed software lives in directories and the operating system wouldn't know where to find it without having PATH updated. Software install by Homebrew usually winds up in /usr/local/bin, which is why they recommend adding it to the system path. If you don't, every time you wanted to run the brew installed version of python you would have to enter /usr/local/bin/python rather than just python. It's also relevant to note that paths further to the left in the list take precedence over those to the right - the system will execute the first on it finds. This is why you write the paths in order of where you want the system to look first. The tilde (~) character is a common *NIX shortcut to your home/user directory. Since you're on a Mac, this will be /Users//. Therefore ~/.profile is a file called .profile that lives in your home directory. .profile, along with .bashrc, .bash_profile and numerous other so called dot files, help setup and control your environment from the command line. They are semi-special in the sense that they typically are not shown to the user unless specifically asked for. If you from the command line entered ls to see the files in your current directory it leaves off files that begin with .; if you enter ls -a you'd see every file. The easiest way to update your ~/.profile is to use a command line based text editor. Since you're new, I recommend using nano . To do this, all you have to do it enter nano ~/.profile. Then enter the path information and save and quit. After you do that, close the terminal completely and then start it again - you need to do this so that the session restarts and the system reads the contents of ~/.profile and updates itself. Then you should be good to go. Enter echo $PATH one more time into the command line and it should read out what you entered in your profile. More on reddit.com
🌐 r/learnpython
4
10
July 3, 2016
How to add Python@3.11 to Path
Output of brew config N/A Output of brew doctor N/A Description of issue Node@18 formula have this information about adding it to PATH so I can use the node command. If you need to have node@18 fir... More on github.com
🌐 github.com
1
1
February 22, 2024
homebrew - How to make python 3.11 my default python3 with brew - Ask Different
You cannot until the default Python is updated to 3.11 which they don’t do until things are compatible. ... For Apple silicon Macs, the export would need to be export PATH="/opt/homebrew/opt/[email protected]/libexec/bin:$PATH" More on apple.stackexchange.com
🌐 apple.stackexchange.com
November 9, 2022
🌐
Mac Install Guide
mac.install.guide › python › brew
Brew Install Python · Mac Install Guide
February 25, 2024 - Apple Command Line Tools are required before installing Python (or any other programming language) because Python installation methods (like UV, Pyenv, and Homebrew) need basic Unix utilities that are not included by default in the macOS. The Mac Path is an environment variable that controls where the operating system looks for executables.
🌐
Ahmad Awais
ahmadawais.com › home › python not found on macos | install python with brew | fix $path
Python not found on MacOS | Install Python with brew | Fix $PATH
June 12, 2023 - Python has been installed as /opt/homebrew/bin/python3 Unversioned symlinks `python`, `python-config`, `pip` etc.
🌐
Reddit
reddit.com › r/learnpython › installed homebrew in terminal (osx 10.11.4), confused on how to "insert the homebrew directory at the top of your path environment variable."
r/learnpython on Reddit: Installed Homebrew in Terminal (OSX 10.11.4), confused on how to "insert the Homebrew directory at the top of your PATH environment variable."
July 3, 2016 -

Hey LearnPython,

I'm jumping into Python and I've been working through all the introductions, playing the games, reading tutorials, and now I want to start playing with it on my desktop.

So I started the process of ensuring everything I'm using is up to date following the [Hitchhiker's Guide to Python] (http://docs.python-guide.org/en/latest/starting/install/osx/#install-osx). My Mac already has Python installed, but it's older. I entered the Homebrew install script in my terminal and then I reached the part in the instructions where it says and I'm not sure what it means or how to make sure that I've installed it at the top of my PATH environment variable:

"The script will explain what changes it will make and prompt you before the installation begins. Once you’ve installed Homebrew, insert the Homebrew directory at the top of your PATH environment variable. You can do this by adding the following line at the bottom of your ~/.profile file

Then it shows this a little below the piece mentioned above:

export PATH=/usr/local/bin:/usr/local/sbin:$PATH

I've been searching all over and I've found questions similar to mine, but not worded the same or geared for a different program. I'm very new to all of this and want to make sure I'm doing it properly.

Thank you!

Top answer
1 of 2
3
PATH is your system path . When you run programs from the command line, the operating system uses PATH as a list of directories where the program might be located. These directories are separated in the list with colons (:). There are a few default locations that the os looks for executable files (you can see them if you run echo $PATH from the command line). However, some user installed software lives in directories and the operating system wouldn't know where to find it without having PATH updated. Software install by Homebrew usually winds up in /usr/local/bin, which is why they recommend adding it to the system path. If you don't, every time you wanted to run the brew installed version of python you would have to enter /usr/local/bin/python rather than just python. It's also relevant to note that paths further to the left in the list take precedence over those to the right - the system will execute the first on it finds. This is why you write the paths in order of where you want the system to look first. The tilde (~) character is a common *NIX shortcut to your home/user directory. Since you're on a Mac, this will be /Users//. Therefore ~/.profile is a file called .profile that lives in your home directory. .profile, along with .bashrc, .bash_profile and numerous other so called dot files, help setup and control your environment from the command line. They are semi-special in the sense that they typically are not shown to the user unless specifically asked for. If you from the command line entered ls to see the files in your current directory it leaves off files that begin with .; if you enter ls -a you'd see every file. The easiest way to update your ~/.profile is to use a command line based text editor. Since you're new, I recommend using nano . To do this, all you have to do it enter nano ~/.profile. Then enter the path information and save and quit. After you do that, close the terminal completely and then start it again - you need to do this so that the session restarts and the system reads the contents of ~/.profile and updates itself. Then you should be good to go. Enter echo $PATH one more time into the command line and it should read out what you entered in your profile.
2 of 2
2
The line export PATH=/usr/local/bin:/usr/local/sbin:$PATH inserts the Homebrew directory to the beginning of the path. Copy the above line of code, open the file .profile found in your home directory, and paste it at the end. The code sets the variable Path equal to two paths plus itself; or in other words prepends two paths to the PATH variable. Semantically it's the same as this: PATH = ['/bin'] PATH = ['/usr/local/bin', '/usr/local/sbin'] + PATH
🌐
Codetinkering
codetinkering.com › homebrew-python-not-found
Homebrew Python Not Found – Code Tinkering
You can then add an export PATH line at the top or bottom of your file with your appropriate Python version like so: export PATH=/opt/homebrew/opt/python@3.10/libexec/bin:$PATH
Find elsewhere
🌐
Mac Install Guide
mac.install.guide › python › path
Mac Python PATH · Mac Install Guide
June 5, 2024 - Your Mac $PATH should contain the Python executable directory: $ echo $PATH /opt/homebrew/opt/python@3.12/libexec/bin:...
Top answer
1 of 3
40

Note: This applies to any versioned Python installation with Homebrew

After installing Python 3.11, you are given the location of the bin folder with Python 3.11:

==> Caveats
Python has been installed as
  /usr/local/bin/python3.11

Unversioned and major-versioned symlinks `python`, `python3`, `python-config`, `python3-config`, `pip`, `pip3`, etc. pointing to
`python3.11`, `python3.11-config`, `pip3.11` etc., respectively, have been installed into
  /usr/local/opt/[email protected]/libexec/bin

You can add this folder to be first in your PATH and python or python3 will pick up Python 3.11 (since those are in the folder):


So: add the following line to ~/.zshrc:

export PATH="$(brew --prefix)/opt/[email protected]/libexec/bin:$PATH"

brew --prefix ensures that the correct path is used, regardless of where your brew install resides.

2 of 3
18

On macOS Ventura & Sonoma on Apple Silicon

To install homebrew's version of python3:

brew install python3

This installs brew's version of python3.x but does not override the the link to macOS's version of python3 when you use the python3 command. You can confirm which python3 is being used with the which python3 command. Now, you have two primary options here:

  1. You can unlink the system default's python3 and relink python3 to the homebrew version (see kraspa11's answer)
  2. You can simply add an alias for python3 in your ~/.zshrc file which can point to brew's version instead (I prefer this because it results in fewer edits to system defaults).

If you prefer option #2:

Open up ~/.zshrc with nano ~/.zshrc or your desired editor. BTW, if you want to see "hidden" files/folders in your /Users/[username] folder where .zshrc resides, open your user folder in finder and press ⇧ Shift + ⌘ Command + . (period). This will show/hide all hidden files and folders in your Finder.

At the end of the .zshrc file, add the following lines:

# ensure "python3" command uses homebrew's version of python3
alias python3=/opt/homebrew/bin/python3
# OPTIONAL: ensure "python" command uses homebrew's version of python3
alias python=/opt/homebrew/bin/python3

I use /opt/homebrew/bin/python3 instead of /opt/homebrew/opt/[email protected] so if/when you update your version from 3.11 to 3.12 and so on, your aliases should always work (until version 4).

Now, save and close your edited .zshrc file. To refresh your terminal to use the new alias(es), enter:

source ~/.zshrc

To ensure that your commands are pointing to the brew version of python3:

which python3 should respond: python3: aliased to /opt/homebrew/bin/python3

and

which python should respond: python: aliased to /opt/homebrew/bin/python3

NOTE: I have only tested all of the above on Apple silicon macOS Sonoma (which is in developer beta, but should be functionally the same as Ventura).

🌐
Reddit
reddit.com › r/macos › python's path on macos
r/MacOS on Reddit: Python's path on MacOS
February 25, 2024 -

I moved from Windows to a MacBook yesterday (runs MacOS 14 Sonoma on Apple Silicon). I'm trying to get Python to work properly on my MacBook but I'm having a hard time figuring it out.

I'm being able to run Python from the terminal but it doesn't run from VSCode. From the terminal (ZSH) too, only python3 ran but not python. To get around that, I followed an online article and added a ~/.zshrc file. I added these two lines to it:

alias python="/usr/bin/env python3"
alias pip="/usr/bin/env pip3"

I tried to install a Python package using pip but it hit me with a WARNING: The script normalizer is installed in '/Users/my_username/Library/Python/3.9/bin' which is not on PATH.

So till now I've understood that Python can be installed on Mac in 3 ways:

  1. The default inbuilt Python that comes with Mac out of the box.

  2. Python installed from the Python website via an installer.

  3. Python installed via Homebrew.

I am not being able to figure out the paths where each of these methods install Python. Which method is better for installing? Homebrew or download from the website? And once I have Python using one of the options, how do I make sure that it is the one used over the system Python? If I override the system Python, will there be any issues? How do I get Python to run from VSCode?

My MacOS and command line knowledge is very rudimentary so please correct me if I've said something wrong.

🌐
YouTube
youtube.com › watch
How to Install Python on macOS using Homebrew - YouTube
In this tutorial, I'll walk you through how to properly install Python on macOS using Homebrew. We'll bypass the default system Python to keep your Mac clean...
Published: March 29, 2026
🌐
Mimo
mimo.org › tutorials › python › how-to-add-python-to-path
How to Add Python to PATH
If you installed Python with Homebrew, add Homebrew’s bin directory to PATH.
🌐
Medium
medium.com › @arafat.azam › installing-python-with-brew-in-mac-properly-203db905aae9
Installing Python3 with brew on Mac properly | by Muhammad Arafat Azam | Medium
March 28, 2022 - Therefore, we need to add /usr/local/opt/python/libexec/bin directory in our $PATH variable in order to use the Homebrew’s version of python and pip.
🌐
GitHub
gist.github.com › patriciogonzalezvivo › 77da993b14a48753efda
How to install Python correctly on Mac OSX · GitHub
As of now, this does not work anymore. On macOS with Homebrew you have to set the path as follows: export PATH="/usr/local/opt/python/libexec/bin:$PATH"
🌐
Opensource.com
opensource.com › article › 19 › 5 › python-3-default-mac
The right and wrong way to set Python 3 as default on a Mac | Opensource.com
Since the Homebrew maintainers are more dependable at updating the release than most of us, we can use Homebrew's version of Python 3 with the following command: ... # If you added the previous alias, use a text editor to update the line to the following alias python=/usr/local/bin/python3 · To make sure the path above points to where Homebrew installed Python in our environment, we can run brew info python and look for the path information.
🌐
PyDevTools
pydevtools.com › home › python developer tooling handbook › reference › homebrew
Homebrew: macOS Package Manager for Python | pydevtools
September 7, 2026 - Homebrew is a package manager for macOS and Linux that installs software outside the operating system’s own package manager, without requiring root access. It manages its own dependency tree, handles updates, and exposes installed binaries on PATH. Homebrew can install Python, but using it as a Python version manager for development is not recommended.
🌐
Python.org
discuss.python.org › python help
MacOS, Homebrew, Search Path, Default Version, and the Latest Version of Python - Python Help - Discussions on Python.org
November 14, 2023 - Over time, I’ve downloaded and installed 1 or more versions of Python. Now I’m becoming a bit more serious about this, so I used Homebrew, with this command: brew upgrade python Supposedly this upgraded Python to version 3.11.6_1. But from a console window, if I type “python --version” I always get version 3.9.7. I’ve tried uninstalling versions of Python I installed earlier and trimming my $PATH variable.