Use the official macOS installer
Instructions checked 18 October 2026 against the official documentation linked below. Menu labels may differ between releases; verify the selected interpreter rather than relying only on its display name.
This guide follows the python.org Python 3.15 .pkg installer. Read that release’s macOS and processor requirements; do not assume every historical Mac can run the newest installer.
- Open the official macOS downloads page. Download a supported stable release’s macOS installer and run the .pkg. The installer identifies the Python Software Foundation as its signer.
- Follow the installer and read its Read Me. Use the standard installation unless you have a specific reason to customise it. Administrator permission may be needed.
- In Applications → Python 3.15, run Install Certificates.command to complete certificate setup. Substitute your installed version in the folder name.
- Open a new Terminal window and verify the version and executable path.
Terminal
python3 --version
python3 -c "import sys; print(sys.executable)"Create and run hello.py
Create a folder called python-practice in a location you can write to. Open it in your editor, create hello.py, and enter print("Hello, Python!"). Save it as plain text with the .py extension, not hello.py.txt. Open a terminal in that folder; the commands below run the saved file, not unsaved editor changes.
Use an editor such as IDLE or VS Code, not a rich-text document. In Terminal, use cd to enter the project folder, then run the command below. Expected output: Hello, Python!
Terminal — inside python-practice
python3 hello.pyResolve common macOS problems
If python is missing but python3 works, use python3 outside a virtual environment. If a terminal offers to install Apple developer tools, check which python3 it found with command -v python3 and compare sys.executable with your intended installation.
Do not remove or replace /usr/bin/python3. It belongs to Apple’s tooling. Multiple installations can coexist; choose the intended executable for your project and editor.
For certificate verification failures with the python.org installation, complete Install Certificates.command and check the network or organisation’s certificate requirements. Do not disable HTTPS verification to make package installation succeed.
If a file is not found, check the current folder and exact filename. If a package import fails, install it into the interpreter used by that project.
Syntax
print("Hello, Python!")Examples
Your first Python program
Save as hello.py in your project folder. Expected output: Hello, Python!
print("Hello, Python!")- print is a built-in function that writes to the output stream.
- The quoted text is a string. The quotes are not printed.
- Parentheses pass that string to print. No extra package is required.
Best practices
- Save your work before running it, and check the output after each small change.
- Keep your learning project in its own folder. Do not name files after standard modules such as random.py or json.py.
Runtime & versions
Python interpreter. Feature availability depends on the language and runtime version used by your project; consult the official reference below.
Python language reference