# Configuring TEX search paths

TEX systems run on a huge variety of platforms, and are typically made up of a very large number of very small files in several separate ‘trees’ of directories (folders). This allows users to update parts of the system without having to update all of it, and to maintain their own tree of preferred files without having to have administrative rights on the computer.

To make sure TEX finds the right file, it uses a technique borrowed from the Unix world, based on a simple ‘hash index’ for each directory tree they need to look in. This is known as the ls-R database, from the Unix command (`ls -R`) which creates it. The program which does this for TEX is actually called after this command: mktexlsr, although it may be aliased as texhash or something else on your system. This is the program referred to in step 4.

However, to know where to make these indexes, and thus where to search, TEX needs to be told about them. You don't normally need to change the configuration, but sometimes you might want to move directories between disks to free up space or use faster equipment, which would mean changing the configuration.

In a standard TEX installation this information is in the main (not the local) installation directory, in `texmf/web2c/texmf.cnf`. The file is similar to a Unix shell script, but the only lines of significance for the search paths are the following (this is how they appear in the default Unix installation, omitting the comments):

```TEXMFMAIN = /usr/share/texmf
TEXMFLOCAL = /usr/local/share/texmf
HOMETEXMF = \$HOME/texmf
TEXMF = {\$HOMETEXMF,!!\$TEXMFLOCAL,!!\$TEXMFMAIN}
SYSTEXMF = \$TEXMF
VARTEXFONTS = /var/lib/texmf
TEXMFDBS = \$TEXMF;\$VARTEXFONTS```

This defines where the main TEX/METAFONT (`texmf`) directory is, where the local one is, and where the user's personal (home) one is. It then defines the order in which they are searched, and makes this the system-wide list. A temporary directory for bitmap fonts is set up, and added to the list, defining the places in which texhash or mktexlsr creates its databases.

In some installations, the local directory may be set up in `/usr/share/texmf-local` or `/usr/share/texmf.local` instead of `/usr/local/share/texmf` or similar variations, so you would see this name used instead. Under Microsoft Windows, the names will be full paths such as `C:\Program Files\TeXLive\texmf` or `C:\Program Files\MikTeX 2.8\tex`. On an Apple Mac, it is `~/Library/texmf` for each user.