Aloha,
So the reason is so that TeXShop be compatible with OS X 10.4. So when developing engines (say in bash) set COMMAND_MODE=legacy at the top so that your engine behaves like it would in TeXShop.
Macros where you use "do shell script" are trickier. If on OS X 10.5 or greater you run the following code from the Applescript Editor
--Applescript direct
tell application "TeXShop" to display dialog (do shell script "echo $COMMAND_MODE")
you will get a dialog saying "unix2003", but if you paste it in a TeXShop macro (in the Macros menu) and run it you will get a dialog saying "legacy".
The fix is to add "COMMAND_MODE=legacy;" at the beginning of any "do shell script" statement, in our example
--Applescript direct
tell application "TeXShop" to display dialog (do shell script "COMMAND_MODE=legacy; echo $COMMAND_MODE")
The commands whose behavior has changed are: awk, echo in bash, exit, chown, cp, crontab, date, df, du, ex, vi, view, vim, file, grep, join, less, more, ls, mkfifo, mv, pr, ps, sed, sort, stty, uudecode, uuencode, who and xargs. See <
http://developer.apple.com/mac/library/releasenotes/Darwin/RN-Unix03Conformance/index.html> for details.
Mahalo for you patience,
Ramón