[Tex/LaTex] Compiler automatically create specified output directory

foldersoutput

I would like to handle my projects such that every time I compile a .tex file, the compiler would always place the output .pdf in a directory named output (and create it if it doesn't exist).

Here's a sample Terminal session where the --output-directory option cannot create the specified directory if it doesn't exist.

\$ tex --output-directory=output
This is TeX, Version 3.1415926 (TeX Live 2010)
**\relax
! I can't write on file texput.log'.
(Press Enter to retry, or Control-D to exit; default file extension is .log')
Please type another transcript file name:


In TeXShop, how do I specify the command to do as I wish?

mkdir -p output