I am using MacTex 2017 with OS X High Sierra. When I try to compile a .tex file using pdflatex it gets stuck at finding a package packagename.sty.

After some searching that I found those packages installed inside the directory


When I run sudo texhash I get

texhash: Updating /opt/local/etc/texmf/ls-R...
texhash: Updating /opt/local/share/texmf/ls-R...
texhash: Updating /opt/local/share/texmf-local/ls-R...
texhash: Updating /opt/local/share/texmf-texlive/ls-R...
texhash: Updating /opt/local/var/db/texmf/ls-R...
texhash: Done.

I did not find packagename.sty inside any of the files above.

But if I set the variable TEXINPUTS as,

export TEXINPUTS=$TEXINPUTS:/usr/local/texlive/2017/texmf-dist/tex/latex/packagename/

Then pdflatex is able to find packagename.sty.

So my question is how do I tell texhash to update the config files to tell pdflatex to find the packages inside the directory /usr/local/texlive/2017/texmf-dist/tex/latex/<packages> automatically without having to set the variable TEXINPUTS myself ?

related question : How does LaTeX find package files?

  • 2
    Something is up with your setup: looks like root doesn't have your TL'17 system on the path, but rather MacPorts or similar – Joseph Wright Nov 27 '17 at 21:16
  • Do you have another TeX distribution installed by MacPorts or Fink? What does echo $PATH return when run in Terminal? – Herb Schulz Nov 27 '17 at 21:43
  • @JosephWright Ok. I recently added MacPorts and Fink on my system. – UnadulteratedImagination Nov 27 '17 at 22:10
  • @HerbSchulz 'echo $PATH' returns /opt/local/bin:/opt/local/sbin:/sw/bin:/sw/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/usr/local/heroku/bin – UnadulteratedImagination Nov 27 '17 at 22:13
  • Add the line export PATH=/Library/TeX/texbin:$PATH to the bottom of your .profile and/or .bash_profile found in you HOME folder so that the TeX Live installed by MacTeX is found before the other distributions. MacPortsand Fink play with you PATH variable. – Herb Schulz Nov 27 '17 at 23:20

Your Answer

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

Browse other questions tagged or ask your own question.