For performance reasons. I would like to be able to run pdflatex directly from memory and not have to go to disk. Plan is to set up a RAM disk, /RamDisk, and run everything there.

Currently I have installed


and my source is of the form


Based on Determine active distribution via shell script, I can determine the current active distribution

DIST="$(kpsewhich -var-value=SELFAUTOPARENT)"

I will create the RAM disk and perform a

cp -rp /usr/local/texlive/${DIST} /RamDisk/texlive/.

which I will eventually modify to only copy over exactly what I need and not the entire distribution,. I will also copy over my source directories as well:

cp -rp $HOME/LaTeX/source      /RamDisk/LaTeX/.
cp -rp $HOME/LaTeX/texmf-local /RamDisk/LaTeX/.

After compilation, I will copy over the pdf files from the RamDisk to my home directory so that they are not lost upon startup.


  • What do I have to set in a bash script to ensure that the search path for executables such as pdflatex) etc is:

    /usr/local/texlive/${DIST}     (in case /RamDisk does not exist)

    and for packages is

    $HOME/LaTeX/texmf-local       (in case /RamDisk does not exist)
  • Bonus: I only need pdflatex/makeidx/xindy. Is the subdirectories of /usr/local/texlive/${DIST} that I need to copy over easy to determine.



  • MacOS High Sierra (Version 10.13.4)
  • 1
    You must need really high performance. Out of interest, what is your use-case? – Henri Menke May 10 '18 at 9:24
  • To relocate the search path, change TEXMFROOT in your local texmf.cnf (read the instructions in texmf-dist/web2c/texmf.cnf) – Henri Menke May 10 '18 at 9:28
  • You should just need to set your PATH so the new copy of pdflatex is found, all the default search paths are relative to the executable location. – David Carlisle May 10 '18 at 12:28
  • For performance an SSD in favor of a disk already makes a difference when compiling a large pdf. – Christoph S May 10 '18 at 12:31
  • If your runs are slow because you are loading a lot of files, preloading them into a format file would presumably be quicker than loading them from a ramdisk – David Carlisle May 10 '18 at 12:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.