i'm using Textmate and MacTeX (texLive 1.12). There is the option in MiKTeX (Windows) to use the command -aux-directory=DIR and -output-directory=DIR. The output part works in TeXLive, but the PDF does not auto open, and there are still an aux-file in the main folder, and also a .fdb_latexmk file.

Does anybody know if there is an -aux-directory=DIR command for TeXLive?

  • 5
    Workaround: Use -output-directory=AUX_DIR and set up a soft/hard link from AUX_DIR/out.pdf to OUT_DIR/out.pdf. (ln [-s] AUX_DIR/out.pdf OUT_DIR/out.pdf) Now you have all auxiliary files in AUX_DIR, and output file in the required directory. Viewer auto refresh works whenever the original pdf file in AUX_DIR is updated.
    – Sameer
    Sep 15, 2014 at 18:20
  • @Sameer I did not understand "set up a soft/hard link from AUX_DIR/out.pdf to OUT_DIR/out.pdf. (ln [-s] AUX_DIR/out.pdf OUT_DIR/out.pdf)." Could you please spell it out for a beginner like me? I am using TeX-Studio with Texlive. Thanks! Mar 19, 2018 at 10:09
  • There has been a good explanation, why sometimes an aux-directory makes sense, see here: tex.stackexchange.com/a/445301/4736 . In short: PDF goes to the server, aux-files remain local.
    – Keks Dose
    Aug 9, 2018 at 13:12
  • Related tex.stackexchange.com/q/420573/35864
    – moewe
    Aug 9, 2018 at 15:06

3 Answers 3


Short answer: 'no'. The -aux-directory option is MiKTeX-specific, as you can see by doing for example pdftex --help with TeX Live:

Usage: pdftex [OPTION]... [TEXNAME[.tex]] [COMMANDS]
   or: pdftex [OPTION]... \FIRST-LINE
   or: pdftex [OPTION]... &FMT ARGS
  Run pdfTeX on TEXNAME, usually creating TEXNAME.pdf.
  Any remaining COMMANDS are processed as pdfTeX input, after TEXNAME is read.
  If the first line of TEXNAME is %&FMT, and FMT is an existing .fmt file,
  use it.  Else use `NAME.fmt', where NAME is the program invocation name,
  most commonly `pdftex'.

  Alternatively, if the first non-option argument begins with a backslash,
  interpret all non-option arguments as a line of pdfTeX input.

  Alternatively, if the first non-option argument begins with a &, the
  next word is taken as the FMT to read, overriding all else.  Any
  remaining arguments are processed as above.

  If no arguments or options are specified, prompt for input.

-draftmode              switch on draft mode (generates no output PDF)
-enc                    enable encTeX extensions such as \mubyte
-etex                   enable e-TeX extensions
[-no]-file-line-error   disable/enable file:line:error style messages
-fmt=FMTNAME            use FMTNAME instead of program name or a %& line
-halt-on-error          stop processing at the first error
-ini                    be pdfinitex, for dumping formats; this is implicitly
                          true if the program name is `pdfinitex'
-interaction=STRING     set interaction mode (STRING=batchmode/nonstopmode/
-ipc                    send DVI output to a socket as well as the usual
                          output file
-ipc-start              as -ipc, and also start the server at the other end
-jobname=STRING         set the job name to STRING
-kpathsea-debug=NUMBER  set path searching debugging flags according to
                          the bits of NUMBER
[-no]-mktex=FMT         disable/enable mktexFMT generation (FMT=tex/tfm/pk)
-mltex                  enable MLTeX extensions such as \charsubdef
-output-comment=STRING  use STRING for DVI file comment instead of date
                          (no effect for PDF)
-output-directory=DIR   use existing DIR as the directory to write files in
-output-format=FORMAT   use FORMAT for job output; FORMAT is `dvi' or `pdf'
[-no]-parse-first-line  disable/enable parsing of first line of input file
-progname=STRING        set program (and fmt) name to STRING
-recorder               enable filename recorder
[-no]-shell-escape      disable/enable \write18{SHELL COMMAND}
-shell-restricted       enable restricted \write18
-src-specials           insert source specials into the DVI file
-src-specials=WHERE     insert source specials in certain places of
                          the DVI file. WHERE is a comma-separated value
                          list: cr display hbox math par parend vbox
-synctex=NUMBER         generate SyncTeX data for previewers if nonzero
-translate-file=TCXNAME use the TCX file TCXNAME
-8bit                   make all characters printable by default
-help                   display this help and exit
-version                output version information and exit

Email bug reports to [email protected].

Notice that there is -output-directory but no -aux-directory, something that can be verified by a quick test (as the documented and actual behaviour can be different!).

  • 2
    Does anybody know why MacTeX is like this? Is there any prospect of a change?
    – twsh
    Jun 7, 2014 at 15:32
  • 3
    @Tom You are asking the wrong question :-) TeX Live has never had an -aux-directory setting, it's something that Christian Schenk added for MiKTeX. So an equally-valid question is 'Why does MiKTeX do this?'!
    – Joseph Wright
    Jun 7, 2014 at 15:33
  • 5
    why do they do this ? the idea of an output directory is general enough that it could and should be a standard option
    – nicolas
    Jul 23, 2017 at 6:58

Somewhat along the lines of what Sameer commented, this is what works for me using TeXstudio.

Modify the pdflatex command (found in Preferences » Commands) in the following manner:

sh -c "mkdir -p .temp & pdflatex -synctex=1 -interaction=nonstopmode -output-directory=.temp %.tex && cp .temp/%.pdf %.pdf"

This will create a hidden directory .temp (if not there already) to store the auxiliary files in it, while keeping the pdf output in the same directory. You can modify the above to your liking and obtain any directory structure you want.

  • I tried this but it doesn't work - says Could not start Build & View:PdfLaTeX:...
    – Ur Ya'ar
    Aug 22, 2019 at 8:22

On a Mac, when using Tex Live, there are two issues that need to be resolved: (i) your aux-folder has to be there initially and (ii) the output file is also stored there. They are easy to overcome by defining two user commands, e.g. in texstudio:

  • user command 1 mkdir: check whether directory for auxiliary files ./aux-files exists, if not create it

mkdir -p ./aux-files

  • user command 2 copy: copy pdf files from auxiliary directory to root directory

sh -c 'cp -f `find ./aux-files -type f -name "*.pdf"` .'

Next, change the default compiler to

txs:///mkdir | txs:///pdflatex

so that the directory is created first.

Change the builder to

txs:///compile | txs:///view | txs:///copy

and the pdf is copied to root after compiling.

This will resolve both issues.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .