How to Create and Execute a Command Line Script with Python on macOS (and Linux)

Python can be a very powerful replacement of Bash to write scripts that can used inside the command-line. Unfortunately, for the Python beginner, some non-obvious steps are required to transform a “normal” program into an executable script. This post will explain exactly how to execute a Python script from the command line explaining each necessary step.