How to run a python script in the Mac Terminal

Tyler Tyler (291)
Total time: 1 minute 

This guide will show you how to run a Python script in the Mac Terminal (command line) in either Mac OS X or MacOS.


Howchoo is reader-supported. When you buy through links on our site, we may earn a small affiliate commission at no cost to you.

Simply navigate to the script directory and type:


This will use the python interpreter to run your script.

You might need to specify the full path to the python interpreter.

which python

should produce:


So you might try running: