Python - Python Installation on Mac
Installing Python 3 on a Mac is a simple process. Follow this step-by-step guide to get Python up and running on your macOS.
Step 1: Check If Python is Already Installed
macOS comes with a pre-installed version of Python, but it might be outdated. To check the installed version:
- Open Terminal (
Cmd + Space
, type Terminal, and press Enter). - Type the following command and press Enter:
python3 --version
- If Python 3 is installed, you will see an output like:
Python 3.x.x
- If Python 3 is not installed or you see an outdated version, or command not found error, proceed with the installation.
Step 2: Install Python 3 Using Homebrew (Recommended Method)
(A) Install Homebrew (If Not Already Installed)
Homebrew is a package manager for macOS that makes installing software easy.
- Open Terminal.
- Run the following command to install Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Once the installation is complete, verify Homebrew is installed by running:
brew --version
If installed, it will display the Homebrew version.
(B) Install Python 3 with Homebrew
Once Homebrew is installed, install Python 3 by running:
brew install python
This will install the latest version of Python 3.
Step 3: Verify Python Installation
After installation, confirm Python is installed correctly by running:
python3 --version
You should see output like:
Python 3.x.x
To check if pip
(Python’s package manager) is installed, run:
pip3 --version
If installed, it will display the pip version.
Step 4: Set Python 3 as Default (Optional)
On macOS, running python
may still refer to Python 2.7. To always use Python 3, follow these steps:
- Open Terminal.
- Run the following command to update your shell configuration:
echo 'alias python="python3"' >> ~/.zshrc source ~/.zshrc
- Now, typing
python
will default topython3
.
Step 5: Run Python in Interactive Mode
To start Python in interactive mode, open Terminal and type:
python3
This will open the Python shell (>>>
), where you can run Python commands.
To exit Python, type:
exit()
or press Ctrl + D
.
Congratulations! Python 3 is now installed on your Mac!
You’re now ready to write and run Python programs 🚀
No problems available for this topic.

Join the community of 1 Lakh+ Developers
Create a free account and get access to tutorials, jobs, hackathons, developer events and neatly written articles.
Create a free account