MacOS – Automatically hide latex aux files in finder (files with a certain extension)

finderlatexmacos

I'm a LaTeX user in OSX. I use TexShop primarily. LaTeX automatically creates lots of helper files with various different extensions (.log, .nav, .aux, .out, etc).

It's almost never necessary to view these, so they add a ton of clutter to the finder folders. Does anyone have a good way of automatically hiding these files in the finder? Specifically, I want to hide all of the files with those extensions automatically. They are created every time I compile, so I need a way either for the finder to ignore them (in the way the windows explorer can treat certain extensions as hidden by default) or for the hidden flag to be set automatically upon creation.

I could actually do this globally if necessary, as my workflow rarely ever gives me cause to invoke or manipulate .log files from the finder. The ideal situation would be to do it only for the folders and sub-folders I use for writing.

Best Answer

Hiding all files isn’t implemented on a system level: make a certain file type hidden

Hiding files one by one is trivial:

 chflags hidden /path/to/*\.aux

I haven't seen a way to implement all the logic required to do what you ask, but I have seen people make up smart folders to show only specific files in a folder that match the good extensions. If your list of places where you want to filter is small, that effort will be less than scripting the hide tool you need.

Have you ruled out configuring latex to put all auxiliary files in a hidden subdirectory/folder that you name with a dot like .tmp? This is shown here for pdflatex -output-directory=\.tmp

Alternatively, you could use a make tool like rubber or latexmk to either run your custom hide script or even discard those files when you compile successfully. You’d only then need to mark in some way what folders get the hidden treatment.