# How to make LaTeX see local texmf tree

I recently installed TeXLive 2011 on my Mac running Snow Leopard. I did not download MacTeX (for reasons we won't go into here). I'm running into a problem where `pdflatex` can't see my local texmf tree. I have the tree at `~/Library/texmf` and I have a symbolic link to that directory at `~/texmf`.

In a previous installation, it could see my tree at `~/Library/texmf` without me doing any extra configuration after installation.

What do I need to do to make [la]tex see my local tree?

-
If you didn't install MacTeX, did you install it using `install-tl`? I hate to tell you this, but installing MacTeX might be faster than solving this problem. (Especially since 99% of Mac users have MacTeX and therefore little experience with the basic TL install.) –  Alan Munn Oct 4 '11 at 23:01
@Jeremy: yes bad idea if you don't know how to manage a tl distribution. The best way is to install MacTeX. –  Alain Matthes Oct 5 '11 at 3:55
@alanMunn Unfortunately, I don't have the option of using MacTex. I don't have admin access so I can't install MacTex. Previously I had tl installed through install-tl -in-place and it found my local texmf tree without any trouble. I was hoping for a simple solution. –  Jeremy Oct 5 '11 at 4:56

Untested, since I don't have the setup that you do. Try the following:

`````` tlmgr conf texmf TEXMFHOME "~/Library/texmf:~/texmf"
``````

And see if that works. Normally this would be run with `sudo` but since you don't have admin access, I'm assuming that running it without will work for you.

-
This worked. Can I simply set my TEXMFHOME variable in my ~/.bash_profile? –  Jeremy Oct 5 '11 at 13:03
No, because if you use TeX from within an editor, for example, or any regular application that isn't called from your shell, your `.profile` is not read. This sets it at the distribution level, which will be read by any call to a tex binary independent of your profile. That's why @Patrick suggested a different route in his answer, but IMO the method I've suggested is to be preferred. –  Alan Munn Oct 5 '11 at 16:03

When you install TeX Live, there is a bunch of path settings that you can modify:

``````<D> directories:
TEXDIR (the main TeX directory):
/usr/local/texlive/2011
TEXMFLOCAL (directory for site-wide local files):
/usr/local/texlive/texmf-local
TEXMFSYSVAR (directory for variable and automatically generated data):
/usr/local/texlive/2011/texmf-var
TEXMFSYSCONFIG (directory for local config):
/usr/local/texlive/2011/texmf-config
TEXMFVAR (personal directory for variable and automatically generated data):
~/.texlive2011/texmf-var
TEXMFCONFIG (personal directory for local config):
~/.texlive2011/texmf-config
TEXMFHOME (directory for user-specific files):
~/texmf
``````

You can easily change `TEXMFHOME` during installation to point to your desired destination like `~/Library/texmf` with both command-line and GUI installer. If you are already past that point, you can find a file `texmf.cnf` on top level folder where you installed TeX Live (next to `texmf-whatever` trees). If not, just create a new one. Change (or create) the line with `TEXMFHOME` to:

``````TEXMFHOME = ~/Library/texmf
``````

MacTeX sets (redefines) the following variables inside `texmf.cnf`:

``````% (Public domain.)
% ...
TEXMFHOME = ~/Library/texmf
TEXMFVAR = ~/Library/texlive/2011/texmf-var
TEXMFCONFIG = ~/Library/texlive/2011/texmf-config
``````

You could do the same if you want identical locations as in MacTeX, but I would not advise you to touch `TEXMFVAR` after installation is over or at least you should better move folders from old location to the new one.

For personal installation I would advise you to select the `portable` installation anyway and only change `TEXMFHOME`.

Please note that Alan Munn's suggestion with

``````> tlmgr conf texmf TEXMFHOME "~/Library/texmf:~/texmf"
setting texmf TEXMFHOME to ~/Library/texmf:~/texmf (in /path/to/your/texlive/texmf.cnf)
``````

does exactly the same (except the triviality that it sets search path to two different folders) in a user-friendly way, provided that you can remember that command. I find it easier to simply edit the configuration file (or reinstall TeX Live if I screw up other settings as well :).

-
Just a note about editing `texmf.cnf`: If you have installed TeX Live as an admin user, the default place for this file will be `/usr/local/texlive/<year>/texmf.cnf`. Since this is in space that is only writable by admin users, you need to either edit it from within the terminal using `sudo <editor> ...` or use a GUI editor that allows you to authenticate and save (e.g. TextWrangler, but not e.g. TextEdit). –  Alan Munn Oct 5 '11 at 23:28

Try running `kpsewhich -var-value TEXMFLOCAL` to see where TeX thinks your local `texmf` tree should be.

-
I think you mean `TEXMFHOME` not `TEXMFLOCAL`. –  Alan Munn Oct 5 '11 at 0:01
When I run the command `kpsewhich -var-value TEXMFLOCAL` I get `/path/to/somewhere/TeXLive2011/texmf-local`. When I do `kpsewhich -var-value TEXMFHOME` I get `/home/jlconlin/texmf`. –  Jeremy Oct 5 '11 at 12:57
@Jeremy Justin's answer identifies the problem, but doesn't solve it. The second command shows that TeX thought that your local texmf folder was in `/home` which isn't a directory that is even used on a Mac. –  Alan Munn Oct 5 '11 at 16:07

You can edit your `~/.MacOSX/environment.plist` and set `TEXMFHOME` to `/Users/<your short username>/Library/texmf`. That file is a plain text XML file you can edit by hand or use XCode (link to a Technical Q&A doc from Apple). The next time you log in, all applications have that environment variable set, even if they are not run from the terminal (which reads `~/.bash_profile`).

-
In my experience, using `.MacOSX/environment.plist` can cause more problems than it solves. In this particular case (setting just `TEXMFHOME` it might be relatively benign, but e.g. using it to set paths can be very problematic. –  Alan Munn Oct 5 '11 at 11:28