# LaTeX can't find .cls files

I recently downloaded MacTeX-2015 and wrote a very short file which I called test.tex:

\documentclass{article}
\begin{document}

Hello world.
$e^{2\pi i} = 1.$

\end{document}


I opened the file in TeXShop, where it compiled and generated a PDF just fine. However, when I opened Terminal and told it "pdflatex test.tex", I got the following error message:

This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2015/01/01>
Babel <3.9l> and hyphenation patterns for 79 languages loaded.

! LaTeX Error: File article.cls' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: cls)

Enter file name:


I found that the required file, article.cls, lived at /usr/local/texlive/2015/texmf-dist/tex/latex/base/article.cls, so I entered this as the file name Terminal was asking for. I then got the following message:

Enter file name: /usr/local/texlive/2015/texmf-dist/tex/latex/base/article.cls
(/usr/local/texlive/2015/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: clo)


I repeated what I did before and told Terminal that size10.clo lives at /usr/local/texlive/2015/texmf-dist/tex/latex/base/size10.clo, after which Terminal decided to cooperate and gave me a perfectly normal pdf.

My question is this: why can't LaTeX find the files it needs to build my PDF, and what can I do to fix this besides manually telling it where all of the files are? I've tried uninstalling and reinstalling MacTex several times, but to no avail. I also tried telling Terminal "sudo texhash" on a friend's suggestion, but that didn't fix my problem either. I'm new to LaTeX and don't know much about computers, so I would appreciate if you could explain what's going on in non-technical terms. Thanks so much in advance!

• A warm welcome to TeX.SE! I'm not a mac person, but I would bet that you somehow need to make your tex installation available system wide by manipulating your path. Although one would think a proper installation would do that. The path is simply something that says "look in those folders for this information". – A Feldman May 14 '16 at 22:25
• Like I said, I've uninstalled and reinstalled MacTeX several times. A quick Google search told me that the command "echo \$PATH" gives a colon-separated list of the items in my path; when I typed this into Terminal, I found that /Library/TeX/texbin, where my LaTeX tools are located, is indeed one of the directories in my path. From this, it seems that my installation should be able to access my entire system; what other paths should I be looking at? – David Grabovsky May 14 '16 at 22:37
• LaTeX2e <2015/01/01> is too old for for an up to date texlive 2015 release (should be 2016/03/31) check you haven''t got a local installation masking the recently installed version – David Carlisle May 14 '16 at 22:52
• I'm pretty sure I only have one tex installation on my computer; typing "which -a latex" into Terminal gave only one result; namely, /Library/TeX/texbin/latex. Are there other ways of checking whether I have other versions of LaTeX on my computer? I also wasn't aware that 2016 versions of any LaTeX-related software even existed. I don't see anything on the MacTeX installation website... – David Grabovsky May 14 '16 at 23:02
• EDIT: I ran a large update on texlive; I'm still getting the same errors as before, but now "LaTeX2e <2015/01/01>" has been replaced by "LaTeX2e <2016/03/31>". Unfortunately, this doesn't fix my problem. – David Grabovsky May 14 '16 at 23:52