Check existing Python
macOS includes an older Python version for system use. Let’s check what you have:-
Open Terminal:
- Press
Cmd + Spaceto open Spotlight - Type “Terminal” and press Enter
- Or find Terminal in Applications > Utilities
- Press
- Check Python version:
Some Mac users can use just
python instead of python3, but this depends on your system configuration. When in doubt, use python3.Download Python
- Go to python.org/downloads
- The site will detect you’re on macOS and show the latest version
- Click the download button to get the
.pkginstaller
Always download from python.org to ensure you get the official, secure version.
Install Python
- Open the downloaded
.pkgfile - The Python installer will open
- Click “Continue” through the introduction and license screens
- Click “Agree” to accept the license
- Click “Install” (you’ll need to enter your Mac password)
- Wait for installation to complete
- Click “Close” when you see “The installation was successful”
Verify installation
Open a new Terminal window (important!) and check the version:Test Python
Let’s make sure Python works properly:- In Terminal, type:
- You’ll see something like:
- Try your first Python command:
- Press
Enterand you should see:
- To exit Python:
- Type
exit()and press Enter - Or press
Ctrl + D
- Type
Troubleshooting
'python3' command not found
'python3' command not found
The Terminal might not see the new installation yet.
Solution 1: Close Terminal completely and open a new window.
Solution 2: Check if Python is installed but not in PATH:Solution 3: Add Python to your PATH manually:
Solution 1: Close Terminal completely and open a new window.
Solution 2: Check if Python is installed but not in PATH:
'python' command doesn't work
'python' command doesn't work
This is normal on macOS. You have three options:
Option 1: Always use
Option 2: Create an alias:Option 3: Check if the installer created a
Option 1: Always use
python3 (recommended)Option 2: Create an alias:
python link:SSL/Certificate errors
SSL/Certificate errors
You forgot to install certificates. Fix it by
Running from Terminal:Or manually installing certificates:
Running from Terminal:
Multiple Python versions
Multiple Python versions
macOS can have multiple Python versions. To manage them:
See all installed versions:Use a specific version:Set a default (example for 3.13):
See all installed versions:
Alternative: Homebrew installation
If you prefer using a package manager:1
Install Homebrew
2
Install Python
3
Verify installation
Homebrew Python might use different paths than the official installer. Both work fine.
Next steps
Perfect! Python is now installed on your Mac. Let’s set up your code editor.Continue to VS Code introduction
Install and configure Visual Studio Code