Python and the Unix Shell

# Running Python scripts from the Unix Shell

| MacPython 2.3 installs a perfectly normal Unix commandline python interpreter in `/usr/local/bin/python`. As of Mac OS X 10.2, however, `/usr/local/bin` is not on the search path of your shell. Moreover, Apple's python 2.2, which lives in `/usr/bin` is on your search path, so this can lead to confusion. If you use `tcsh` you should add the following line to the file `.login` in your home directory and restart Terminal: `setenv PATH /usr/local/bin:$PATH` If you use `bash` or `zsh` you should add the following line to the file `.profile` in your home directory and restart Terminal: `export PATH=/usr/local/bin:$PATH` ## GUI scripts Due to the way MacOS handles windowing applications you need to run all scripts that use the window manager (be it through Carbon, Cocoa, Tkinter, wxPython, PyOpenGL or anything else) with the `pythonw` interpreter, also installed in `/usr/local/bin`. Running with `python` results in an inability to bring the script to the front, or interacting with it.