1

I know that it's /usr/local/texlive/2021/texmf-dist on my machine (MacOS), but how can I get this path programmatically from the command line? I don't see it in my env, but tlmgr works perfectly: installs and removes packages at this location.

yegor256
  • 12,021
  • 1
    kpsewhich -var-value TEXMFDIST or kpsewhich -var-value TEXMFMAIN should point to that directory (see e.g. https://tug.org/texlive/doc/texlive-en/texlive-en.html#x1-110002.3). In general kpsewhich is used to find files for TeX. – moewe Jan 05 '22 at 05:28
  • @moewe this works. Please, turn this into an answer and I'll accept it – yegor256 Jan 05 '22 at 05:52

1 Answers1

3

You can find the subtree in which system-installed packages are located by typing

kpsewhich -var-value TEXMFDIST

in the command line. See https://tug.org/texlive/doc/texlive-en/texlive-en.html#x1-110002.3 for other texmf trees and their meaning.

In general, TeX uses kpsewhich to find system-installed files. If you are looking for a specific file

kpsewhich <filename>

e.g. kpsewhich article.cls is really helpful.


Remember not to install any files manually into TEXMFDIST. Also do not modify any files there. The subtree is controlled by your TeX distribution (primarily by tlmgr): files can be overwritten or deleted at any time. Manual installations can go into TEXMFLOCAL (system wide, usually needs admin/root permission) or TEXMFHOME (user-specific, usually does not need special permissions). (Where do I place my own .sty or .cls files, to make them available to all my .tex files?, How do I install an individual package on a Linux system?)

moewe
  • 175,683