How to default Python3.8 on my Mac using Homebrew?

Here is the solution:

If existing symlinks belong to python 3.7 you should unlink them:
brew unlink python

Basically all you need to do:
brew link --force [email protected]

OR force the link and overwrite all conflicting files:
brew link --force --overwrite [email protected]

OR if needed list all files that would be deleted:
brew link --overwrite --dry-run [email protected]

Thus you can switch to any python version available in the Homebrew repo.

Also check out this answer for pyenv usage


Ok, thanks to @gromgit from Homebrew community discussion (https://discourse.brew.sh/t/how-to-default-python-3-8-on-my-mac-using-homebrew/7050)

Here is the solution:

$ brew info [email protected]
[email protected]: stable 3.8.1 (bottled) [keg-only]
...
==> Caveats
Python has been installed as
  /usr/local/opt/[email protected]/bin/python3
...
[email protected] is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have [email protected] first in your PATH run:
  echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bash_profile

For compilers to find [email protected] you may need to set:
  export LDFLAGS="-L/usr/local/opt/[email protected]/lib"

For pkg-config to find [email protected] you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig"

I will stick to python (v3.7.6) at this time and wait for seamless upgrade of v3.8.1 in the future releases.


You might have to add python 3.8.1 to your PATH in your ~/.bash_profile and put it first so that it overrides previous installations. First find out where python 3.8.1 was installed, then add it to your path like this:

export PATH="/PATH_TO_PYTHON/:${PATH}"


I have a company Mac with Python 2.7 preinstalled to run older software.

$ brew install pyenv (successful)
$ pyenv install 3.9.2 (successful)
$ python --version
Python 2.7
$ pyenv global 3.9.2
$ python --version
Python 2.7 

It still says Python 2.7, so, I did the following commands

pyenv init
eval "$(pyenv init -)"

$ python --version
Python 3.9.2

More details: Link