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.
- 12,021
1 Answers
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?)
- 175,683
kpsewhich -var-value TEXMFDISTorkpsewhich -var-value TEXMFMAINshould point to that directory (see e.g. https://tug.org/texlive/doc/texlive-en/texlive-en.html#x1-110002.3). In generalkpsewhichis used to find files for TeX. – moewe Jan 05 '22 at 05:28