When documents are typeset, auxiliary files are created with extensions .aux, .log, .bbl, etc. Occasionally these files can become corrupt and lead to unexplained typesetting errors. TeXShop has a menu command "Trash AUX Files" which will remove all such files so typesetting can proceed. There is a similarly named button on the Console window. If either of these items is activated, TeXShop will move to the trash all files in the current source directory with the same name as the source file and extension aux, blg, brf, ccs, ent, fff, glo, idx, idv, ilg, ind, ioa, lg, log, lot, mte, mlf, out, pdfsync, toc, ttt, wrm, bcf, run.xml, synctex, synctex.gz, xref, 4ct, 4tc, fls, or fdb_latexmk.
Additional extensions can be added to this list. To add "dvi" to the list, activate the Terminal and type
To remove all additions and return to the original default list, tppe
Sometimes more extensive cleanup is needed. For example, if a book is controlled by main.tex, and chapters are in subfolders accessed with commands like \include{chapter1/chapter1}, then typesetting the book will create main.aux, main.pdfsync, and main.log in the main folder, and chapter1.aux in the chapter1 folder.
The required extensive cleanup can be done by holding down the option key while choosing "Trash AUX Files." In this case:
There is a way to make this behavior the default behavior for "Trash AUX Files" even if the option key is not down: