After installing python3 with brew install python3 I was getting the error:

Error: An unexpected error occurred during the `brew link` step
The formula built, but is not symlinked into /usr/local
Permission denied @ dir_s_mkdir - /usr/local/Frameworks
Error: Permission denied @ dir_s_mkdir - /usr/local/Frameworks

After typing brew link python3 the error was:

Linking /usr/local/Cellar/python/3.6.4_3... Error: Permission denied @ dir_s_mkdir - /usr/local/Frameworks

To solve the problem:

sudo mkdir -p /usr/local/Frameworks
sudo chown -R $(whoami) /usr/local/*
brew link python3

After this, I could open python3 by typing python3 👍

(From https://github.com/Homebrew/homebrew-core/issues/20985)

Answer from lenooh on Stack Overflow
Discussions

Cannot link python3 in MacOS High Sierra
To help us debug your issue please explain: What you were trying to do (and why) I tried to install python3 on MacOS High Sierra. The only installed python version is the default 2.7 release. After successfully running brew install pytho... More on github.com
🌐 github.com
3
November 23, 2017
Link multiple Python versions
It's not currently possible, but I believe it is possible in principle if the various Python formulae were fixed up to support this. Dealing with the various executables (python3, pip3, etc) is fairly straightforward, but there are some conflicts that will require a bit more work: ❯ brew link ... More on github.com
🌐 github.com
7
1
python - brew install doesn't link python3 - Stack Overflow
I'm having trouble linking python3 and making python3 the default python. MacOS 10.13.6 Here's what I did: $ python --version Python 2.7.15 $ python3 --version Python 3.7.0 $ xcode-select --vers... More on stackoverflow.com
🌐 stackoverflow.com
Links to current Python are lost after Homebrew update
I appreciate this is frustrating ... was no workaround for the prior group. Additionally, the way Python is being handled now is more consistent how we should be handling other formulae that shadow system versions. Note from the discussion in #14408 that the long-term plan is to have brew install python ... More on github.com
🌐 github.com
July 18, 2017
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).

🌐
AskPython
askpython.com › python › examples › set-homebrew-default-python-version-macos
How to Link and Set Homebrew Python 3.12 as the Default Python Version on macOS - AskPython
February 28, 2024 - We need to explicitly link Python 3.12 as the default python executable. Homebrew maintains symlinks in /usr/local/bin to manage version defaults for various tools and languages. To set Python 3.12 as the new default executable for the python command, run: brew unlink [email protected] && brew link --force --overwrite [email protected]
🌐
GitHub
github.com › Homebrew › homebrew-core › issues › 20985
Cannot link python3 in MacOS High Sierra · Issue #20985 · Homebrew/homebrew-core
November 23, 2017 - What you were trying to do (and why) I tried to install python3 on MacOS High Sierra. The only installed python version is the default 2.7 release. After successfully running brew install python3 I set it as the default python environment with brew link python3.
Author: Homebrew
Top answer
1 of 1
1

It's not currently possible, but I believe it is possible in principle if the various Python formulae were fixed up to support this.

Dealing with the various executables (python3, pip3, etc) is fairly straightforward, but there are some conflicts that will require a bit more work:

❯ brew link --force --dry-run --overwrite python@3.10
Would remove:
/usr/local/bin/2to3 -> /usr/local/Cellar/python@3.9/3.9.9/bin/2to3
/usr/local/bin/idle3 -> /usr/local/Cellar/python@3.9/3.9.9/bin/idle3
/usr/local/bin/pip3 -> /usr/local/Cellar/python@3.9/3.9.9/bin/pip3
/usr/local/bin/pydoc3 -> /usr/local/Cellar/python@3.9/3.9.9/bin/pydoc3
/usr/local/bin/python3 -> /usr/local/Cellar/python@3.9/3.9.9/bin/python3
/usr/local/bin/python3-config -> /usr/local/Cellar/python@3.9/3.9.9/bin/python3-config
/usr/local/bin/wheel3 -> /usr/local/Cellar/python@3.9/3.9.9/bin/wheel3
/usr/local/share/man/man1/python3.1 -> /usr/local/Cellar/python@3.9/3.9.9/share/man/man1/python3.1
/usr/local/lib/pkgconfig/python3-embed.pc -> /usr/local/Cellar/python@3.9/3.9.9/lib/pkgconfig/python3-embed.pc
/usr/local/lib/pkgconfig/python3.pc -> /usr/local/Cellar/python@3.9/3.9.9/lib/pkgconfig/python3.pc
/usr/local/Frameworks/Python.framework/Headers -> /usr/local/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Headers
/usr/local/Frameworks/Python.framework/Python -> /usr/local/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Python
/usr/local/Frameworks/Python.framework/Resources -> /usr/local/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Resources
/usr/local/Frameworks/Python.framework/Versions/Current -> /usr/local/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Versions/Current

This might require special handling of the contents of *.framework directories in brew.

Top answer
1 of 3
56

I presume you mean that you want the command python to start the Python3 interpreter, and pip to start pip3.

The clue is in the message:

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

That means... "if you want the command python to start python3 and pip to start pip3, you need to put /usr/local/opt/python/libexec/bin at the start of your PATH."

So, in your login script ($HOME/.profile or similar), you need to put:

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

Then log out and log back in for it to take effect.


As an aside, brew link python3 only means... "create a symbolic link in /usr/local/bin/python3 that points to /usr/local/Cellar/python/3.7.0/python3".

You can see that link, and where it points to, with:

ls -l /usr/local/bin/python3
2 of 3
5

I had installed python via brew and had to follow different steps:

brew install python

Later, I needed the path to add to my $PATH as export PATH=/usr/local/opt/python/libexec/bin:$PATH wasn't working for me.

I ran:

brew info python

Got this:

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

And then added this to my .zshrc file

export PATH="/opt/homebrew/opt/python@3.11/libexec/bin:$PATH"

With these steps, you have made Python 3.11 the default version on your Mac. You can now use python to refer to Python 3.11 in your terminal.

For more details, I shared the entire process in Python not found on MacOS. I hope this helps.

Make sure to reload your terminal, a fancy way to do that is by running:

exec $SHELL -l
🌐
GitHub
github.com › Homebrew › homebrew-core › issues › 15746
Links to current Python are lost after Homebrew update · Issue #15746 · Homebrew/homebrew-core
July 18, 2017 - Pior to my latest update of Homebrew (1.2.4) I had Python located, as indicated by brew --config, with a link to the latest Homebrew version: Python: /usr/local/bin/python => /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Ve...
Find elsewhere
Top answer
1 of 1
1

It's not currently possible, but I believe it is possible in principle if the various Python formulae were fixed up to support this.

Dealing with the various executables (python3, pip3, etc) is fairly straightforward, but there are some conflicts that will require a bit more work:

❯ brew link --force --dry-run --overwrite python@3.10
Would remove:
/usr/local/bin/2to3 -> /usr/local/Cellar/python@3.9/3.9.9/bin/2to3
/usr/local/bin/idle3 -> /usr/local/Cellar/python@3.9/3.9.9/bin/idle3
/usr/local/bin/pip3 -> /usr/local/Cellar/python@3.9/3.9.9/bin/pip3
/usr/local/bin/pydoc3 -> /usr/local/Cellar/python@3.9/3.9.9/bin/pydoc3
/usr/local/bin/python3 -> /usr/local/Cellar/python@3.9/3.9.9/bin/python3
/usr/local/bin/python3-config -> /usr/local/Cellar/python@3.9/3.9.9/bin/python3-config
/usr/local/bin/wheel3 -> /usr/local/Cellar/python@3.9/3.9.9/bin/wheel3
/usr/local/share/man/man1/python3.1 -> /usr/local/Cellar/python@3.9/3.9.9/share/man/man1/python3.1
/usr/local/lib/pkgconfig/python3-embed.pc -> /usr/local/Cellar/python@3.9/3.9.9/lib/pkgconfig/python3-embed.pc
/usr/local/lib/pkgconfig/python3.pc -> /usr/local/Cellar/python@3.9/3.9.9/lib/pkgconfig/python3.pc
/usr/local/Frameworks/Python.framework/Headers -> /usr/local/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Headers
/usr/local/Frameworks/Python.framework/Python -> /usr/local/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Python
/usr/local/Frameworks/Python.framework/Resources -> /usr/local/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Resources
/usr/local/Frameworks/Python.framework/Versions/Current -> /usr/local/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Versions/Current

This might require special handling of the contents of *.framework directories in brew.

🌐
Homebrew
docs.brew.sh › Language-Runtimes-and-Packages
Homebrew Documentation: Language Runtimes and Packages
Homebrew provides supported Python 3 releases and does not provide Python 2. The python and python3 aliases select Homebrew’s current default Python formula. Versioned formulae for supported older releases remain available according to the versioned formula policy.
🌐
Reddit
reddit.com › r/learnpython › python3 --version not pointing to python 3.14 upon brew installation
r/learnpython on Reddit: python3 --version not pointing to python 3.14 upon brew installation
November 8, 2025 -

So I installed python 3.14 via Homebrew on my Mac, but when I check what version python is running it points to 3.13. What do I need to do to fix this? I tried looking it up on Google but I got varying answers and I don't want to screw things up on my computer.

Any help would be greatly appreciated.

🌐
Michael Currin
michaelcurrin.github.io › dev-cheatsheets › cheatsheets › python › install › install-and-upgrade.html
Install and upgrade Python | Dev Cheatsheets
$ brew unlink python $ brew link python@3.9 Warning: python@3.9 is keg-only and must be linked with --force If you need to have this software first in your PATH instead consider running: echo 'export PATH="/usr/local/opt/python@3.9/bin:$PATH"' >> ~/.zshrc
🌐
GitHub
github.com › Homebrew › brew › issues › 3308
brew link python3 error on macOs High Sierra · Issue #3308 · Homebrew/brew
October 12, 2017 - When I was install python3 with Homebrew. $ brew install python3 Warning: python3 3.6.3 is already installed, it's just not linked. You can use `brew link python3` to link this version._ then I exe...
Author: Homebrew