[Tex/LaTex] Error in MacTex – Font … not loadable: Metric (TFM) file not found

errorsfont-encodingsfontspackagestexlive

This question is exactly the same as this one, but for Mac OS. My error is:

Font OT1/pcr/m/n/9=pcrr7t at 9.0pt not loadable: Metric (TFM) file not found

So I tried the answer in the linked question. My missing file is pcrr7t.tfm. When I tried tlmgr search --file pcrr7t.tfm, it is found in:

courier:  
texmf-dist/fonts/tfm/adobe/courier/pcrr7t.tfm

Therefore, I tried to install courier with sudo tlmgr install courier. It turned out I already have courier.

tlmgr: package repository http://ctan.mirrorcatalogs.com/systems/texlive/tlnet
tlmgr install: package already present: courier

But then why I can't compile the tex file. Thanks in advance.


UPDATE

This error (and some others of the same kind) only occurs when I run pdflatex draft.tex. I can compile OK with TeXShop. But I only want to run from command line.

Best Answer

This seems a problem due to having two distinct TeX Live distributions (which was confirmed in the comments).

You seem to have both a MacTeX provided TeX Live, which is the one used by TeXShop by default (the binaries are in /usr/local/texlive/2015/bin/x86_64-darwin, with a symbolic link at /Library/TeX/texbin, which is added to the PATH environment variable) and also the MacPorts one, that installs its binaries in /opt/local/bin.

Note that the latter distribution doesn't provide tlmgr, so this program is executed from the MacTeX binaries. However, MacPorts places /opt/local/bin high in the PATH variable, so when you run pdflatex from the terminal, the MacPorts binary is used (and the TeX tree corresponding to it). To the contrary, TeXShop is usually configured to run the binaries in /Library/TeX/texbin.

So, running tlmgr does no good to the MacPorts distribution, that has its own package manager.

I know, this looks complicated, but there's a very easy solution: get rid of the TeX Live provided by MacPorts.

Related Question