Probably the safest and easy way is to use brew and then just modify your PATH:

First update brew:

brew update

Next install python:

brew install python

That will install and symlink python3 to python, for more details do:

brew info python

Look for the Caveats:

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

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /usr/local/opt/python/libexec/bin

Then add to your path /usr/local/opt/python/libexec/bin:

export PATH=/usr/local/opt/python/libexec/bin:$PATH

The order of the PATH is important, by putting first the /usr/local/opt/python/libexec/bin will help to give preference to the brew install (python3) than the one is in your system located in /usr/bin/python

Answer from nbari on Stack Overflow
🌐
Mac Install Guide
mac.install.guide › python › path
Mac Python PATH · Mac Install Guide
June 5, 2024 - Since June 2025, Homebrew's install script adds the folder to the end of the $PATH, after /usr/bin. That matters for Python, because the Command Line Tools' Python 3.9.6 is in /usr/bin.
Discussions

macos - Add to python path mac os x - Stack Overflow
So I did add PYTHONPATH "path:$PYTHONPATH" export PYTHONPATH and AFTER I restarted my computer it worked. Big Thanks to Matthew and Felix!! 2010-08-02T13:21:25.533Z+00:00 ... Save this answer. ... Show activity on this post. On MAC OS you can simply find the location of python/python3 by using ... More on stackoverflow.com
🌐 stackoverflow.com
Python's path on MacOS
Just add the directory where you installed python to your PATH. More on reddit.com
🌐 r/MacOS
10
1
February 25, 2024
terminal - How to (and should I) put a path to user-installed python ahead of system-installed python? - Ask Different
I have added the path to user-installed Python using https://www.architectryan.com/2012/10/02/add-to-the-path-on-mac-os-x-mountain-lion/#.Uydjga1dXDg, and it was popped at the end of $PATH. Do I understand correctly that, in the current situation, when I run pip, brew etc. on python3 from bash, ... More on apple.stackexchange.com
🌐 apple.stackexchange.com
February 9, 2020
Python's path on MacOS
it hit me with a WARNING Which method is better for installing? I‘m not sure why you have that warning, but maybe This Stackoverflow Question can help you. I do remember having some problems with zsh in this regard too, but I already forgot as this data back more than a year. If the link I just mentioned doesn’t help you, it may be good to revise install methods to see where the problem stems from. How did you install python? You mentioned three ways, but didn’t say which one you chose. I used the installer from pythons website and everything works fine, but I‘m also on intel (although that shouldn’t matter). Generally I don’t think there’s any superior method. 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? I’m not sure what you mean here. What „system python“ are you talking about and what do you mean with „used over“? As far as I know OSX doesn’t come with python preinstalled and you’re pretty much just installing a framework to run it on. If you want to use a specific version you can use python3.11.7 [path/file.py] to execute a .py file in 3.11.7 for example. Same goes for any other version (at least in python3). If I override the system Python, will there be any issues? Again, as far as I’m concerned OSX doesn’t come with python preinstalled since a long time. And no, of you download multiple versions of python through the installer on the official website, nothing is being overwritten. I’m not sure about the other methods, but I don’t think they’d do either. As mentioned before, to execute different versions, just add the python version to the call python3.12.1 path/file.py (here to execute in 3.12.1). How do I get Python to run from VSCode? VSCode usually detects and chooses an interpreter for you (that you also have installed). Apart from that you can also manually change the interpreter in the settings, the command line or ¿the search bar? (I forgot how it’s called, but I mean the thing where you put in the „>“ to get some options). More on reddit.com
🌐 r/learnpython
9
4
February 25, 2024
🌐
Python documentation
docs.python.org › 3 › using › mac.html
5. Using Python on macOS — Python 3.15.2 documentation
The UNIX command-line tools package, which is selected by default, will install links in /usr/local/bin for python3.15t, the free-threaded interpreter, and python3.15t-config, a configuration utility which may be useful for package builders. Since /usr/local/bin is typically included in your shell PATH, in most cases no changes to your PATH environment variable should be needed to use python3.15t.
🌐
Educative
educative.io › answers › how-to-add-python-to-the-path-variable-in-mac
How to add Python to the PATH variable in Mac
An easier way to avoid this error is to add the executable files’ directory to the PATH variable. This often needs to be done after installing Python. The complete path of the Python (or Python3) UNIX executable can be added (for OS X 10.8 Mountain Lion and up) by:
🌐
Great Learning
mygreatlearning.com › blog › it/software development › how to add python to path?
How To Add Python To Path?
November 15, 2024 - In the "Environment Variables" window (Windows) or terminal (macOS/Linux), find the "Path" variable under the "System variables" section. Windows: Select the "Path" variable and click "Edit."
🌐
Real Python
realpython.com › lessons › adding-python-path-macos
Adding Python to PATH on macOS (Video) – Real Python
So which -a python3, and that’s going to show all of the locations already on your PATH where a python3 executable is found. 03:01 One thing to note, though, is these other ones in /usr/local/bin or /usr/bin. These locations are already automatically added to your PATH, so that’s not going to be very helpful when we want to add a new version.
Published: March 31, 2026
🌐
XDA Developers
xda-developers.com › home › macos › how to add python to path in macos
How to add Python to PATH in macOS
November 2, 2024 - The folder you add needs to be the actual folder that contains the python3 file. Press Ctrl + O to save the .zshrc file and then hit Enter. Press Ctrl + X to exit the text editor. Enter the following command to reload the /zshrc file and save changes: ... That’s it. You have successfully added Python to PATH on macOS.
Find elsewhere
🌐
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
# what I thought would work # first, ... /usr/bin/python2 # lastly, I'll move the new binary to the previous path $ sudo mv $PATHTOBINARY/python3 /usr/bin/python · The pattern followed what /usr/bin/ usually does between major releases ...
🌐
Real Python
realpython.com › add-python-to-path
How to Add Python to PATH – Real Python
July 23, 2026 - You need to prepend the call to the Python executable with its relative path in the current folder (./) because otherwise you’ll invoke whichever Python is currently recorded on your PATH.
🌐
AskPython
askpython.com › python › examples › find-python3-path-macos
How to Find the Python3 Path on MacOS? - AskPython
July 6, 2026 - Homebrew’s python formula installs to /opt/homebrew (Apple Silicon) or /usr/local (Intel) and symlinks python3 into /opt/homebrew/bin/python3 or /usr/local/bin/python3. You can have all three on the same machine. The one your shell finds depends on the order in /etc/paths and your shell profile.
🌐
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.

🌐
Starmorph
blog.starmorph.com › home › add python to path mac os
Add Python To Path Mac OS
March 1, 2023 - To verify that the PATH variable has been updated, type the following command in Terminal: echo $PATH This will print the updated PATH variable, which should include the Python directory. All done! we have Added python to Path In this tutorial, we learned how to add Python to the PATH environment variable in macOS Terminal using zsh shell.
🌐
Programwithus
programwithus.com › learn › python › install-python3-mac
Step by step guide to install Python3 on a Mac | Free Python Resource
April 14, 2021 - Homebrew is a package manager for Mac OS · Step 1. Launch Terminal. ... Step 2. Install HomeBrew · /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" ... Set up PATH environment variable, if you used HomeBrew to install Python3, then HomeBrew already added PATH.
🌐
YouTube
youtube.com › watch
How to Install Python on Mac OS and add to the PATH Variable|python tutorial | python for beginners - YouTube
Subscribe to our channel to get video updates. Hit the subscribe button above: """""Welcome to the magical world where coding meets simplicity. Installing Py...
Published: June 5, 2022
Top answer
1 of 2
8

You can accomplish this by adding

export PATH="/path/to/python:"$PATH

to your ~/.zshrc (or ~/.bash_profile if you're not on Catalina).

I'd like to propose an alternative and suggest pyenv, available via Homebrew. You can set a specific Python version to be "global" (i.e. default everywhere) and/or "local" (i.e. using that version in a specific directory only).

E.g.:

brew install pyenv
pyenv global 2.7.16
cd ~/myProjects/MyProject
pyenv local 3.7.6

If you were to use Python in ~/myProjects/MyProject it will default to 3.7.6, and anywhere else 2.7.16:

cd ~/some/other/directory
python --version
>> Python 2.7.16

cd ~/myProjects/MyProject
python --version
>> Python 3.7.6

https://github.com/pyenv/pyenv#homebrew-on-macos

2 of 2
3

I installed Python 3.8 for macOS using the installer from python.org, not homebrew which is also installed on my Mac but rarely used. I think the first three lines below to my ~/.bash_profile was automatically added by the installer from python.org.

With those, any changes I make using pip3 seem to affect only the 3.8 whereas those made via pip seem to affect only the 2.7 (which I believe comes installed with macOS). Because I did not use homebrew in installing Python 3.8 (or 2.7), I assume it is not relevant for either version of Python in my case. Hope these help.

# Setting PATH for Python 3.8
PATH="/Library/Frameworks/Python.framework/Versions/3.8/bin:${PATH}"
export PATH

# Setting PATH for Python 2.7
# I believe the two lines below were already in the file before the above were added
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to add python to path on windows, linux, and mac
How to Add Python to PATH on Windows, Linux, and Mac
December 12, 2025 - Use the Edit button to change the saved address and the Move Up and Move Down buttons to change the order of addresses within the PATH variable. Since PATH management on Linux and macOS is done using CLI, the procedure for editing and deleting PATH directories is slightly more complicated than on Windows.
🌐
YouTube
youtube.com › watch
How to Add Python to PATH on Mac (Terminal & Finder Methods) - YouTube
Having trouble running Python from your Mac's terminal? In this video, I'll show you exactly how to manually add Python to your PATH environment variable on ...
Published: April 5, 2026
🌐
Mimo
mimo.org › tutorials › python › how-to-add-python-to-path
How to Add Python to PATH
Many macOS setups work without manual PATH edits, especially if you used Homebrew. This section is for cases where python3 exists but your shell can’t find it, or you’re picking up the wrong one. ... If you installed Python with Homebrew, add Homebrew’s bin directory to PATH.
🌐
Reddit
reddit.com › r/learnpython › python's path on macos
r/learnpython 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.

Top answer
1 of 2
1
it hit me with a WARNING Which method is better for installing? I‘m not sure why you have that warning, but maybe This Stackoverflow Question can help you. I do remember having some problems with zsh in this regard too, but I already forgot as this data back more than a year. If the link I just mentioned doesn’t help you, it may be good to revise install methods to see where the problem stems from. How did you install python? You mentioned three ways, but didn’t say which one you chose. I used the installer from pythons website and everything works fine, but I‘m also on intel (although that shouldn’t matter). Generally I don’t think there’s any superior method. 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? I’m not sure what you mean here. What „system python“ are you talking about and what do you mean with „used over“? As far as I know OSX doesn’t come with python preinstalled and you’re pretty much just installing a framework to run it on. If you want to use a specific version you can use python3.11.7 [path/file.py] to execute a .py file in 3.11.7 for example. Same goes for any other version (at least in python3). If I override the system Python, will there be any issues? Again, as far as I’m concerned OSX doesn’t come with python preinstalled since a long time. And no, of you download multiple versions of python through the installer on the official website, nothing is being overwritten. I’m not sure about the other methods, but I don’t think they’d do either. As mentioned before, to execute different versions, just add the python version to the call python3.12.1 path/file.py (here to execute in 3.12.1). How do I get Python to run from VSCode? VSCode usually detects and chooses an interpreter for you (that you also have installed). Apart from that you can also manually change the interpreter in the settings, the command line or ¿the search bar? (I forgot how it’s called, but I mean the thing where you put in the „>“ to get some options).
2 of 2
1
Pyenv is going to do a lot to help you manage the various Python installs, and you can install it with Brew: https://formulae.brew.sh/formula/pyenv