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.

    How to install brew on Mac

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

    Comments & Discussion

    Facing issues? Have questions? Post them here! We're happy to help!