How to install Python using Mac Terminal


Before we see how to install Python using Mac Terminal, you should be aware that all versions of macOS are shipped with at least one version of Python.

You can verify that you running the below command.


Check if Python is Installed using Terminal

    If the Mac has Python 2.x installed.

    python --version
    
    Python 2.7.1

    If the Mac has Python 3.x installed.

    python3 --version
    
    Python 3.11.4

    Note: If somehow Python is not installed on your Mac you will see an error like,

    zsh: command not found: python

    zsh: command not found: python3


Installing Python on Mac using Terminal

  1. Make sure Homebrew is installed on your Mac.
    brew --version
    Homebrew 4.1.4

    If you get an error "command not found: brew", then first install brew using Terminal by following the below tutorial.

  2. To install Python, run the below command on the Terminal.
    brew install python
How to install Python using Mac Terminal

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright ยฉ Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap