I installed Python3 via brew:

brew install python@3.9

And following the symlink chain of which python3 leads to:

$ which python3

$ ls -l /usr/local/bin/python3
lrwxr-xr-x  1 user  admin  41 27 Jul 17:44 /usr/local/bin/python3 -> ../Cellar/python@3.9/3.9.13_1/bin/python3

$ ls -l /usr/local/Cellar/python\@3.9/3.9.13_1/bin/python3
lrwxr-xr-x  1 user  staff  55 23 Jul 08:45 /usr/local/Cellar/python@3.9/3.9.13_1/bin/python3 -> ../Frameworks/Python.framework/Versions/3.9/bin/python3

$ ls -l /usr/local/Cellar/python\@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/bin/python3
lrwxr-xr-x  1 user  staff  9 23 Jul 08:44 /usr/local/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/bin/python3 -> python3.9

$ ls -l /usr/local/Cellar/python\@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/bin/python3.9
-rwxr-xr-x  1 user  staff  13620 23 Jul 08:42 /usr/local/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/bin/python3.9

I also installed offlineimap with:

python3 -m pip install offlineimap

And the shebang line shows:


which points to a different binary:

$ ls -l /usr/local/opt/python@3.9/bin/python3.9
lrwxr-xr-x  1 user  staff  57 23 Jul 08:45 /usr/local/opt/python@3.9/bin/python3.9 -> ../Frameworks/Python.framework/Versions/3.9/bin/python3.9

$ ls -l /usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/bin/python3.9
-rwxr-xr-x  1 user  staff  13620 23 Jul 08:42 /usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/bin/python3.9

and the two have the same versions:

$ python3 --version
Python 3.9.13
$ /usr/local/opt/python@3.9/bin/python3.9 --version
Python 3.9.13

How could I have installed two instances of the same Python? How can I uninstall the non-brew version?

  • 2
    For me, /usr/local/opt/python@3.9 is a symlink pointing to ../Cellar/python@3.9/3.9.13_1. Are you sure that in your case it's pointing to a different binary? Jul 27 at 23:55
  • 1
    @JohnPalmieri Indeed, for me too. So it seems that both point to the same binary, and I was led astray because the binary inside /usr/local/opt/python@3.9/bin/python3.9 is following the symlink of /usr/local/opt/python@3.9/ two nodes above, right? Can you write an answer? Jul 28 at 8:07
  • 1
    I hope any answer will clear the confusion between python3 (and pip3) installed in /usr/local/bin and python3 (and pip3) installed in /usr/bin.
    – Gilby
    Jul 28 at 10:44
  • 1
    @Gilby that is a separate question and I think answered here before. This question is about various links and files made by homebrew
    – mmmmmm
    Aug 1 at 14:56
  • 1
    I could not find an exact answer but it is implicit in many of them asking how to upgrade python - if you really want to know ask and either someone else will know the duplicate or in a day or two I could attempt a fuller answer but I would have missed the details in this question so would not be complete.
    – mmmmmm
    Aug 1 at 15:27

2 Answers 2


For me, and maybe in general, /usr/local/opt/python@3.9 is a symlink pointing to ../Cellar/python@3.9/3.9.13_1, and both correspond to Homebrew's Python 3: no duplicate executable. In contrast, /usr/bin/python3 is provided by Apple. On my machine, it's version 3.8.9 of Python, in contrast to Homebrew's version 3.9.13.


Homebrew installs the Apple Silicon binaries in /opt/homebrew and the Intel ones in /usr/local in addition to making a symbolic link for the actual program Which is outside your path to a location in the expected path. You should have two copies of python and maybe three if you have that Apple Silicon history.

Once nice thing on homebrew, is you can usually check the installed formulas and do a clean removal, then just reinstall the versions you need.

Is there a problem with letting the path manage which of the programs gets called?

  • 1
    The question was about /usr/local/opt, not /opt, and at least on my (Intel) machine, those are different: /opt came from MacPorts, /usr/local and /usr/local/opt from Homebrew. Jul 28 at 17:25
  • Hmm - I have revised this for the three locations. Thanks for pointing out my error @JohnPalmieri
    – bmike
    Jul 28 at 20:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .