Making TeXShop aware of the TEXINPUTS environment variable

by Shareef Dabdoub.

Sorry, it can't be done.

Not yet anyway, unless you want to contact Richard Koch, the primary developer of TeXShop, and ask very nicely.

So to back up a bit first, the basic problem we want to solve is this: There are some TeX or BibTeX style files or just some common image or other files that we want general include to when writing documents. It's ugly and a hassle to copy those files alongside the current document you're working on, so TeX provides the TEXINPUTS environment variable that you can point to a directory or a list of directories that such files exist in:

export TEXINPUTS="~/folder:/other_folder:"

While this works great for compiling documents from the command line, or environment variable-aware editors, unfortunately TeXShop does not check environment variables.

What you can do, however, is make use of the Tex Directory Structure (TDS) which is supported by TeXShop. The official recommendation for the TDS root is texmf (for "Tex and Metafont"). TeXShop expects this directory to be under ~/Library. For our purposes, the relevant directory structure should look like:


According to the mactex FAQ, TeX will search for your files in the tex/ directory and LaTeX will search the tex/latex folder. I haven't tested this extensively, but TeXShop appears to have no problem finding files/directories under either tex/ or tex/latex when compiling with LateX. Note that you may have to create this directory structure yourself.

If you have an existing directory full of your common files that you don't want to move, no problem! symlink!

> cd ~/Library/texmf/tex/latex
> ln -s ~/path/to/shared/files/dir shared

This command will create a symbolic link (essentially a redirection), which looks like a folder and acts like a folder, but actually points somewhere else on the disk (to remove it the rm command works).

Follow me on GitHub.