'How to set Python3 as default in MacOS Monterey (Macbook Air M1)?
Solution 1:[1]
You can use symbolic link:
ln -s -f /usr/local/bin/python3 /usr/local/bin/python
Solution 2:[2]
If you are on Mac M1
Steps
1. $ brew install python
2. $ sudo ln -s -f /opt/homebrew/bin/python3 /usr/local/bin/python
3. Restart your terminal.
4. $ python --version
If you are on Intel Mac
Steps
1. $ brew install python
2. $ ln -s -f /usr/local/bin/python3.<your version> /usr/local/bin/python
3. Close Terminal and test version
4. $ python --version
Solution 3:[3]
From the information provided it is not possible to say if /usr/bin/python is already a symlink. You can check all the python versions in that directory and see if it is a symlink or not.
ls -l /usr/bin/python*
ls -l /usr/local/bin/python*
If python is an existing symlink
In the case that python is a symlink, you should be able to change the symlink to link to python3 as already suggested here, -s for soft, -f for force to overwrite an existing symlink.
ln -sf /usr/bin/python3 /usr/local/bin/python
If the operation is not permitted you will need to create it as root. If this is good solution I do not know, so use my answer with precaution.
sudo -i
ln -sf /usr/bin/python3 /usr/local/bin/python
Check if the right version is recognised
where python
python -V
From MacOS Monterey 12.3
From MacOS Monterey Version 12.3, python2 is no longer preinstalled, and is shipped with Python 3.8.9. Therefore python is not in use and a symlink can be used without concerns regarding python2.
python -V
zsh: command not found: python
python2 -V
zsh: command not found: python2
python3 -V
Python 3.8.9
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Saliou DJIBRILA |
| Solution 2 | Dharman |
| Solution 3 |


