macOS installation
Install the interpreter, create an isolated workspace, and verify your first script in Terminal.
On this page
Install Python
- Open Python downloads for macOS and choose a stable Python 3 release, version 3.12 or newer.
- Download the macOS installer compatible with your Mac. Open the
.pkg, follow Continue and Install, and finish the installer. - Open a new Terminal window from Applications → Utilities. Enter
python3 --version. If it reports an older version, try the version-specific command for the runtime you installed, such aspython3.14 --version. Use that command to create the environment below.
Create your workspace
mkdir -p ~/python-study
cd ~/python-study
python3 -m venv .venv
.venv/bin/python -c "import sys; print(sys.executable); print(sys.prefix != sys.base_prefix)"Look for a path ending in .venv/bin/python, followed by True. These tell you exactly which interpreter ran and whether it belongs to a virtual environment.
Save and run a file
From this folder, enter nano hello.py or open a plain-text editor and save a file named hello.py here. Enter the Python line below. In nano, press Ctrl+O, Enter, then Ctrl+X to save and return to Terminal. Run the shell command below it.
print("Python is ready").venv/bin/python hello.pyThe expected result is Python is ready. If the file cannot be found, use pwd and ls to check your folder and filename. Build your first local project.