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 is a seasoned developer with over 10 years of experience in web and app development, and a deep knowledge of operating systems. Author of insightful How-To articles for Code2care.

Follow him on: X

Copyright © Code2care 2023 | Privacy Policy | About Us | Contact Us | Sitemap