How to Install Python on macOS & Run Your First Hello World Program

Ready to dive into coding on your Mac? Python is one of the most beginner-friendly and powerful programming languages out there, and macOS makes a great platform to get started. Whether you’re new to programming or just setting up your development environment, this guide will walk you through installing Python on macOS and writing your very first “Hello, World!” program. In just a few steps, you’ll go from zero to running code in your terminal — no prior experience needed. Let’s get your Mac talking Python!

  • Press Cmd + Space to open Spotlight
  • Type “Terminal” and hit Enter

Type this command and press Enter:

python3 --version

If Python is installed, you’ll see something like:

Python 3.11.5

If you get an error, don’t worry—just follow the next step to install it.

Go to the official site: python.org/downloads

Click Download Python for macOS.

  • Open the .pkg file you downloaded
  • Follow the on-screen instructions
  • Python and pip (Python’s package manager) will be installed

Open Terminal and type:

pip3 --version

You should see something like:

pip 23.2.1 from ...

👉 code.visualstudio.com

Click “Download for macOS”.

  • Open the .zip file
  • Drag Visual Studio Code.app into your Applications folder

Open VS Code, press Cmd + Shift + P, and type:

Shell Command: Install 'code' command in PATH

This lets you open VS Code from Terminal using:

code .
  • Click the Extensions icon (or press Cmd + Shift + X)
  • Search for “Python”
  • Install the one by Microsoft
  • Press Cmd + Shift + P
  • Type “Python: Select Interpreter”
  • Choose the version you installed
  • Go to File > New File
  • Save it as hello.py

Paste this into the file:

python

print("Hello, world!")
  • Click the Run button
  • Or right-click and choose “Run Python File in Terminal”

You should see:

Hello, world!

Congrats—you just ran your first Python program!

  • Python Not Found in VS Code Use “Python: Select Interpreter” and make sure Python is installed
  • pip Not Working Try:bashpython3 -m ensurepip python3 -m pip install package_name
  • Terminal Issues In VS Code, go to View > Terminal and click the trash icon to reset
  • Multiple Python Versions Use python3 --version and which python3 to check. Uninstall older versions if needed
  • Virtual Environment Confusion Activate with:bashsource venv/bin/activate
  • Syntax Errors Python is picky about spaces! VS Code helps catch these early
  • Keep Python and VS Code updated
  • Use virtual environments to keep projects organized
Installing python on macOS

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top