Python command not found on Mac OS

Python command not found on Mac OS

If you get the "python command not found" error on macOS, it means that Python is not installed on your computer or is not in your PATH environment variable. To fix this error, you can try one of the following solutions:

  1. Install Python using the official installer from the Python website ( This will automatically add Python to your PATH, so you should be able to use the python command in a terminal window after installation.

  2. If you already have Python installed, you can manually add it to your PATH. To do this, open a terminal window and run the following commands:

export PATH=$PATH:/usr/local/bin/python3
  1. Replace /usr/local/bin/python3 with the path to your Python installation, if it is different.

  2. Alternatively, you can use the full path to the Python executable when running a Python script, instead of using the python command. For example, if Python is installed at /usr/local/bin/python3, you can run a Python script like this:


How to install Python

To install Python on Windows, macOS, and Linux, you can follow these general steps:

  1. Download the latest version of Python from the official Python website ( Make sure to download the version for your operating system.

  2. Once the download is complete, run the installer and follow the on-screen instructions to complete the installation.

  3. After the installation is finished, open a new terminal window and type python to run the Python interpreter. You should see the Python version and the prompt >>>, which indicates that Python is ready to accept commands.

  4. To verify that Python was installed correctly, you can try running a simple program, such as the "Hello, World!" program. In the Python interpreter, type the following:

print("Hello, World!")

This should print the message "Hello, World!" on the screen, indicating that Python is working properly.

To exit the Python interpreter, type exit() or press CTRL + D.

Stay up to date

Get notified when I publish New Games or articles, and unsubscribe at any time.

Thanks for joining!


What is Python?

Python is a high-level, interpreted, general-purpose programming language. It is one of the most popular programming languages and is widely used for various purposes, from web development and data analysis to scientific computing and artificial intelligence. Python is known for its simplicity and readability, and it has a large and active community of users and developers who contribute to its ongoing development and evolution.

What is the error 'Python command not found on Mac OS'?

This error message appears when you try to run the Python interpreter in the terminal but the system can't find it.

How to resolve 'Python command not found on Mac OS'?

There are two common solutions: 1)Install Python using a package manager like Homebrew. 2) Add the Python binary to the PATH environment variable.

How to check if Python is installed on Mac OS?

Open the terminal and run the command 'python3 --version'. If Python is installed, it will display the version number.

How to install Python on Mac OS using Homebrew?

Open the terminal and run the command: 'brew install python3'.

How to add Python to the PATH environment variable on Mac OS?

Add the following line to your '.bash_profile' or '.zshrc' file: 'export PATH=/usr/local/opt/python/libexec/bin:$PATH'.

What should I do if the error persists even after adding Python to the PATH variable?

Try restarting the terminal or log out and log back in to apply the changes to the PATH variable. If the error persists, try reinstalling Python.

Related articles

Ruslan Osipov
Author: Ruslan Osipov