On Unix like system using TeX Live, the command kpsewhich --var-value=TEXMFLOCAL gives the path of the directory where to install homemade package. For example, on my Mac, I obtain the path /usr/local/texlive/texmf-local.

Does this work on Windows using TeX Live ?

  • 6
    Have you tried it? Feb 20, 2015 at 21:47
  • 3
    Personally, I'd use TEXMFHOME. Much less hassle than TEXMFLOCAL...
    – cfr
    Feb 21, 2015 at 4:42
  • 1
    @SeanAllred I do not have easily a Windows computer where to play. My question was for developping some tools to easy install homemade package.
    – projetmbc
    Feb 21, 2015 at 7:51
  • @cfr Good advice. I need to be more carefull with the homemade packages.
    – projetmbc
    Feb 21, 2015 at 7:52
  • 1
    TEXMFHOME is good for personnal work. TEXMFLOCAL is good for all users of the OS... and may require admin/super-user privileges. Jan 13, 2017 at 8:03

3 Answers 3


Although you already got some answers (some of them in the comments), let me say the following: TeXLive (and MikTeX as far as I know)

  1. is set up, to use properly filled TDS, which is TeX Directory Structure(s).
  2. is using the Karl Berry Search Path tools. Therefore you can use the command line tool kpsewhich to determine, where a file is located. This command was inspired by the Unix which-tool, which tries to find the location of a given executable. For the usage in TeX-systems, it was enhanced a little bit.

Especially in TeXLive (but again, I think in MikTeX too), you can use more than one TDS-tree parallel to another. Usually, TeXLive-systems are set up to have three of these TDS-trees:

  1. The TDS for the maintainer of the distributions,
  2. The TDS for the local system administrator,
  3. The TDS for the individual user.

The first one contains all the packages, that came with TeXLive (MikTeX, respectively). It will be installed, when you (as system administrator) install your TeXLive-System. It will be changed, whenever you update your TeXLive-System. Therefore you should not install any packages into that TDS-tree (unless you are an TeXLive maintainer, of course. But why should I explain the setup to you, than?).

The second TDS-tree is for the system administrator, who supports his users with a central repository of readily installed local packages. For example, the style files to obeye your universities corporate design will be installed here. If it is a network share, all TeX users in the whole university (whole company, if you like) can use this files without any further configuration. To be able to install packages in this tree, you usually need to have system administrator rights also, to be able to write files here.

The third and last tree, is the tree for the individual user. It will be located in a directory owned by the user himself; classically this was within the home-directory of the user on Unix systems.

You can use the TeXLive command tool tlmgr to find out, where these three TDS are located on your individual computer. Just run

tlmgr conf

and check for the lines beginning with


They point you to the correct locations in your TeX installation.

(I don't know the tool, which gives this information on MikTeX, sorry.)

There is also a line beginning with texmf.cnf which will list the location of the master configuration file. If you ever plan to change some of the locations and you really know, what you are doing there, thats the file to edit!

There is one other important thing to point out. Nowadays, a full grown TeX system consists of hundreds of thousands of files. It would be tedious for your computer, to search every path over and over again, just to locate say book.cls. (Have I mentioned, that computers are stupid? Computers can't remember those locations, if you don't provide any help!) To prevent searching and searching and searching again, all the files, which are located in the distribution TDS tree and in the Local TDS tree, are stored in a simple database. Therefore it is not sufficient, to copy a file into one of those trees. TeX will not find these files, unless you update the database. Of course, you surely will need super user rights (AKA super cow power :-)) to update the database. On classical Unix systems this used to be the texhash command or mktexlsr which is the short form of "Make the TeX ls-minus-R database" (To be true: it is nothing else than ls -R $TEXMFDIST or whatever TDS tree you want to add to your database.)

To sum up all that: if you plan to enrich the world by releasing a package of yours, to be installed on somebodies else computer, the best way would be to convince the TeXLive maintainers to include it in TeXLive. Than you don't have to worry anymore. If your package is not that important, that you could convince the TeXLive maintainers to have it included, it might be best, to instruct your customers, to install it in the TEXMFHOME part of their system. Just ask them to run

tlmgr conf | grep TEXMFHOME

on Unix-like systems. On newer Windows systems having a bash installed, it might also work. In that location they don't need to have super cow powers nor have they to hassle to update the database. If you happen to give your package to system administrators, they usually know, where to store the package and how to update the database.

P.S: If you want to make sure, that the newest book.cls fresh from CTAN, yould be used on your TeXLive system, while the maintainers didn't incorporate it into their distribution, you have to install it either in TEXMFLOCAL or TEXMFHOME and to configure your system by editing temf.cnf in such manner, that TEXMFDIST will be search at last of the three given TDS trees.


One of the things to keep in mind is that in windows many of the configuration variables are not activated by default, added to this, some things we can do with administrator permissions and others as a simple user. I will incline for the option of simple users, that is to say the configurations will only affect the current user of the system.

For this example, the username is yourself and every time we start a command line cmd we will do it without administardor privileges.

Configuration of variables and directories

  1. Configuration of TEXMFHOME When you run on a command line cmd you will get:
C:\Users\yourself>kpsewhich -var-value=TEXMFHOME

But, in reality the texmf directory does not exist as such, we must create it following the TDS structure. We will create it taking care in the path separator which in this case is \.

C:\Users\yourself>mkdir texmf\tex\latex
  1. Configuration of TEXMFCNF Open a command line cmd and execute the following line:
C:\Users\yourself>kpsewhich -all texmf.cnf

The output indicates that the variable is not configured for our user. We configure it in the following way:

C:\Users\yourself>setx TEXMFCNF C:/Users/yourself/texmf;

CORRECTO: se guardó el valor especificado.

We go out and we go back in and run:

C:\Users\yourself>reg query HKEY_CURRENT_USER\Environment

    Path    REG_EXPAND_SZ    %USERPROFILE%\AppData\Local\Microsoft\WindowsApps;
    TEMP    REG_EXPAND_SZ    %USERPROFILE%\AppData\Local\Temp
    TMP    REG_EXPAND_SZ    %USERPROFILE%\AppData\Local\Temp
    OneDrive    REG_EXPAND_SZ    C:\Users\yourself\OneDrive
    TEXMFCNF    REG_SZ    C:/Users/yourself/texmf;

We have finished setting this variable. This variable will be used in conjunction with the auxtrees command in the example.

  1. Configuration of TEXINPUTS Suppose we have a directory D:/transcripts sections or images but they are only available locally and we want them for testing. The best thing in this case is to use the TEXINPUTS variable and here it depends on whether we want the configuration to be permanent (always available) or temporary (only in the current console).

a. Temporary configuration Open a command line cmd and execute:

C:\Users\yourself>set TEXINPUTS=.;D:/transcripts//;

this will work until you close the command line, that is, you must execute this every time after close a command line.

b. Permanent configuration Open a command line cmd and execute:

C:\Users\yourself>setx TEXINPUTS .;D:/transcripts//;

close command line. In this way we have configured TEXINPUTS in your environment variable and now it is permeating.

If you need to see TEXINPUTS from environment variable, use:

C:\Users\yourself>reg query HKEY_CURRENT_USER\Environment

If you need to delete TEXINPUTS from environment variable, use:

C:\Users\yourself>reg delete HKEY_CURRENT_USER\Environment /v TEXINPUTS /f

Alternatively this can be done in a graphical mode adjusting your environment variable.

Full example using auxtrees

This is part of the configuration that we use with a group of colleagues in my work using a project hosted in github (which we also distribute in .zip format) with the use of some packages and custom classes, transcribe the part related to windows (I hope you understand, my native language is Spanish). The TDS folder for this example is located in D:/ltxcole/stycole/ and the structure of the project is:

Listado de rutas de carpetas para el volumen driveD
El número de serie del volumen es FACD-A6DF
│   ├───diagnostico
│   ├───guias
│   ├───pruebas
│   ├───test
│   └───trabajos
│   ├───diagnostico
│   ├───guias
│   ├───pruebas
│   └───test

The key is in stycole which has a TDS structure:


The TeXLive documentation for Windows configurations is not very "explanatory", but, in the forum there is good information. The use of auxtrees allows you to maintain several projects without affecting the entire system using the TEXMFLOCAL variable or loading everything into TEXMFHOME.

Open a command line cmd and execute:

C:\Users\yourself>tlmgr conf auxtrees --conffile C:/Users/yourself/texmf/texmf.cnf show
tlmgr.pl: no auxiliary texmf trees defined.

the output tells us that we have nothing configured, now we run:

C:\Users\yourself>tlmgr conf auxtrees --conffile C:/Users/yourself/texmf/texmf.cnf add D:/ltxcole/stycole/

to verify that everything is correct we run:

C:\Users\yourself>tlmgr conf auxtrees --conffile C:/Users/yourself/texmf/texmf.cnf show
List of auxiliary texmf trees:

With this we have finished configuring our project, the files placed in D:/ltxcole/stycole/tex/latex/ will be available for all our files. The file C: Users\yourself\texmf.cnf contains the following line:

TEXMFAUXTREES = D:/ltxcole/stycole/,

and you can add as many projects as you want as long as you respect the TDS structure.

Of course, if you only want to do tests for yourself it is simpler to use TEXMFHOME, although the advantage of using auxtrees+git is that you can generate a cross-platform configuration script or a simple README with relevant instructions for a collaborative project.

  • This is why people hate latex
    – Keine
    Jul 26, 2020 at 12:41

I never heard of kpsewhich before. However, I copy/pasted the command line you gave and got


So I guess it does work. (Incidentally, using HOME instead of LOCAL gives only a blank line.)

  • 3
    The question deals with TeX Live, not with MiKTeX.
    – egreg
    Feb 21, 2015 at 9:41
  • Oops. My bad. Sorry.
    – Mark
    Feb 21, 2015 at 22:05

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.