How to run a Python script from Mac OS X Finder

Here is how to run a Python script from the Finder:

  • Make this the first line of your Python script "#!/usr/bin/env python"
  • Change the extension of the script file to ".command" i.e. my_python_script.command
  • In Terminal make the Python script file executable by running "chmod +x my_python_script.command"
  • Now when you double click the Python script in Finder it will open a terminal window and run.

1 comment:

Dario said...

Thank you so much! It worked! ;o)