MacTex: Cannot find input file

I have a minimal LaTeX file called untitled.tex.

btrost@rt4382m-ggb: ~/Desktop>cat untitled.tex
\documentclass{article}

\begin{document}

Hi

\end{document}


When I run pdflatex on the file, which obviously exists, it says it can't find the file:

btrost@rt4382m-ggb: ~/Desktop>pdflatex untitled.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016) (preloaded     format=pdflatex)
restricted \write18 enabled.
entering extended mode
! I can't find file untitled.tex'.
<*> untitled.tex

(Press Enter to retry, or Control-D to exit)
Please type another input file name:


I experienced this problem on another Mac and reinstalling MacTex fixed the problem, but on this Mac it did not. I am running Max OS X 10.12.1 (16B2555). This happens on all .tex files, not just the minimal example above. In addition to pdflatex, the same thing happens when I run latex. Any ideas? Thanks in advance for any help!

(Edit)

btrost@rt4382m-ggb: ~/Desktop>ls -alF ~/Desktop/
total 5724648
drwx------+  6 btrost  staff   204B  7 Nov 12:13 ./
drwxr-xr-x+ 69 btrost  staff   2.3K  7 Nov 12:09 ../
-rw-r--r--@  1 btrost  staff   8.0K  7 Nov 12:13 .DS_Store
-rw-r--r--   1 btrost  staff     0B 30 Jun 17:03 .localized
-rw-r--r--@  1 btrost  staff   2.7G  7 Nov 10:33 mactex-20161009.pkg
-rw-r--r--@  1 btrost  staff    62B  7 Nov 10:53 untitled.tex


Permissions seem fine to me. If I double-click on the file, it opens in TeXShop. If I try to typeset it in TeXShop, it does work (!). In TeXShop, when I go to preferences and then the "engine" tab, (pdf)tex is set to /Library/TeX/texbin. However, when I write /Library/TeX/texbin/pdflatex untitled.tex at the command line (cwd = Desktop), I get the can't find file error.

samcarter: If I run pdflatex /Users/btrost/Desktop/untitled.tex, I get the following. It appears that it does find the file this time (but for some reason cannot find article.cls). Perhaps this is diagnostic? Thank you all once again for the help!! I really appreciate it.

btrost@rt4382m-ggb: ~/Desktop>pdflatex /Users/btrost/Desktop/untitled.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(/Users/btrost/Desktop/untitled.tex
LaTeX2e <2016/03/31>
Babel <3.9r> and hyphenation patterns for 83 language(s) loaded.

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

Enter file name:


Also, I updated to sierra. I think this problem started when I updated. Here are the outputs of which latex and echo $PATH: btrost@rt4382m-ggb: ~/Desktop>echo$PATH
btrost@rt4382m-ggb: ~/Desktop>which pdflatex
/usr/local/texlive/2016/bin/universal-darwin/pdflatex


Looks like pdflatex does live in two different places: /usr/local/texlive/2016/bin/universal-darwin/ and /Library/TeX/texbin. Not sure if this is "normal" or not. They both have the same problem, though.

Here's where /Library/TeX/texbin points:

btrost@rt4382m-ggb: /Applications/IGV_2.3.80.app/Contents/Java>ls -l /Library/TeX/texbin
lrwxr-xr-x  1 root  wheel    63B  7 Nov 10:43 /Library/TeX/texbin@ -> /Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin


@ means extended attributes. I don't think it has anything to do with permissions (see https://discussions.apple.com/thread/1202723?start=0&)

• What does ls -alF ~/Desktop return? Do you have strange permissions on the file? Does the file actually appear on the Desktop? If you Double Click on the file on the Desktop does it open in TeXShop or some other Front End? If TeXShop does open the file can you Typeset it within TeXShop? – Herb Schulz Nov 7 '16 at 16:33
• Just as a test, what happens if you give the full path e.g. pdflatex /Users/btrost/Desktop/untitled.tex? – samcarter_is_at_topanswers.xyz Nov 7 '16 at 17:28
• samcarter: see the edit above. Thanks very much. – brt381 Nov 7 '16 at 17:49
• Ok... what does which pdflatex and echo \$PATH return? I wonder if you have more than one pdflatex? Did you start with a fresh install of Sierra or did you update. – Herb Schulz Nov 7 '16 at 21:35
• What does ls -l /Library/TeX/texbin and/or ls -l /Library/TeX give? One or other should be a link: where does it point? – cfr Nov 8 '16 at 4:05