Install Python and Visual Studio Code (Mac) — Interactive Checklist Form
Objective
This guide explains, step by step, how to install:
- Python
- Visual Studio Code (VS Code)
- The Python extension for VS Code
- A simple test program to confirm everything is working
Review Information
Before You Start
You need:
- A Mac computer
- Internet access
- Permission to install software
It is a good idea to close unnecessary programs before starting.
Step 1 — Download Python
Open your web browser.
Download the latest Python installer for macOS.
Wait for the
.pkgfile to finish downloading.
Step 2 — Install Python
Open the downloaded Python
.pkginstaller.Click Continue through the installation steps.
Click Install.
Enter your Mac password if asked.
Wait for installation to complete.
Click Close when finished.
Step 3 — Verify Python Installation
Open Terminal.
- Open Finder
- Go to Applications > Utilities
- Open Terminal
Type:
python3 --version- Press Return.
You should see something like:
Python 3.x.x- Also test pip by typing:
pip3 --versionStep 4 — If Python Does Not Work
If python3 is not found:
Close Terminal.
Install Python again from python.org.
Open a new Terminal window.
Test again with:
python3 --versionStep 5 — Download Visual Studio Code
Open your web browser.
Click Download for Mac.
Wait for the file to download.
Step 6 — Install Visual Studio Code
Open the downloaded VS Code file.
Drag Visual Studio Code into the Applications folder.
Open Applications.
Double-click Visual Studio Code.
If macOS shows a security message, click Open.
Step 7 — Install the code Command in Terminal
Open VS Code.
Press:
Cmd + Shift + P
- Type:
Shell Command: Install 'code' command in PATH
- Click the command.
This allows you to open folders from Terminal using code ..
Step 8 — Install the Python Extension
In VS Code, click the Extensions icon on the left.
In the search box, type:
Python
Find Python by Microsoft.
Click Install.
Step 9 — Open a Working Folder
In VS Code, click File > Open Folder.
Create or choose a folder for Python work.
Example:
/Users/YourName/Documents/Python-Projects
- Click Open.
Step 10 — Create a Test Python File
In VS Code, click File > New File.
Save the file as:
test.py
- Add the following code:
print("Hello Yahya - Python is working on Mac!")- Save the file.
Step 11 — Select the Python Interpreter
- Press:
Cmd + Shift + P
- Type:
Python: Select Interpreter
Click it.
Select the installed Python 3 interpreter.
Step 12 — Run the Test Program
You can run the file in either of these ways.
Option B — Run from Terminal
In VS Code, click Terminal > New Terminal.
Find the full path to your
test.pyfile:
On Mac — using Finder:
- Open Finder and locate your
test.pyfile. - In the menu bar, click View > Show Path Bar.
- A path bar will appear at the bottom of the Finder window, showing the full folder path.
- Right-click on the folder name in the path bar and choose Copy “FolderName” as Pathname.
- The full path is now copied to your clipboard (for example:
/Users/YourName/Documents/PythonCourse).
In the terminal, type
cdfollowed by a space, then paste your path:Mac:
cd /Users/YourName/Documents/PythonCourse
Step 13 — Install Common Python Packages
In the VS Code terminal, type:
pip3 install pandas matplotlib numpy openpyxlPress Return.
Step 14 — Check Installed Packages
To confirm installation, type:
pip3 listLook for packages such as:
- pandas
- matplotlib
- numpy
- openpyxl
Step 15 — Optional: Install Homebrew
Mac comes with an older version of Python that Apple uses internally — it is not meant for everyday coding. Homebrew is a free tool that lets you easily install the latest version of Python (and other developer tools) with a single command. Think of it as an app store for your terminal.
1. Open Terminal
Press Command + Space, type Terminal, and press Return.
2. Install Homebrew
Copy and paste the following command into Terminal, then press Return:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
This may take a few minutes. You may be asked to enter your Mac password — this is normal.
3. Install Python via Homebrew
Once Homebrew is installed, run:
brew install python
4. Confirm Python is Working
Run the following to check the installed version:
python3 --version
You should see something like:
Python 3.x.x
If a version number appears, you are all set!
Step 16 — Useful Mac Notes
- On Mac, use
python3instead ofpythonin most cases. - On Mac, use
pip3instead ofpipin most cases. - If VS Code does not immediately find Python, restart VS Code.
- If Terminal does not see the new installation, close and reopen Terminal.
Troubleshooting
Problem 1 — python3 not recognized
Fix:
- Reinstall Python from python.org
- Open a new Terminal window
- Test again
Problem 2 — VS Code cannot find interpreter
Fix:
- Press
Cmd + Shift + P - Select
Python: Select Interpreter - Choose the correct Python 3 version
Problem 3 — Permission error with pip
Try:
pip3 install --user pandas matplotlib numpy openpyxlProblem 4 — code command not found
Fix:
- Open VS Code
- Run
Shell Command: Install 'code' command in PATH - Restart Terminal
Summary
You have now completed the following:
- Installed Python on Mac
- Installed Visual Studio Code
- Installed the Python extension
- Enabled the
codecommand - Selected the Python interpreter
- Created and ran a test Python file
- Installed common Python packages
Next Suggested Step
Create a second file named:
hello.py
Add:
name = input("What is your name? ")
print("Hello", name)Then run:
python3 hello.py