# How do I restore my TeX path?

I have an up-to-date installation of MacTeX (2012) on my machine, but a recent upgrade of my system software seems to have removed TeX from my path. TeX Live Utility recognizes my installation and confirms that it is current, as do the settings in System Preferences, but the path is missing.

Is there a TeX utility that I can run to restore it, or do I need to re-donwnload and re-run the MacTeX installer?

• Try doing "`ls /etc/paths.d`" from a terminal window. If `TeX` doesn't appear, issue "`echo /usr/texbin > TeX`" and then "`sudo mv TeX /etc/paths.d`"; the system will ask your password, give it and press return. Logoff an login. Note that I used the quotes only to emphasize the commands to issue. – egreg Jul 27 '12 at 23:25
• I agree with egreg. After an update of Lion with Mountain Lion, I lost the file TeX. If you used Time Machine, you can find the file TeX. Personally, I used TextMate to create the file TeX with the content `/usr/texbin`. – Alain Matthes Jul 28 '12 at 7:34
• @egreg: That seems to do the trick (in the process I discovered that Applescript does not use `path_helper` to find what's in what's in `/etc/paths.d`, but that's another issue). Is this the only MacTeX thing that Mountain Lion messed up, or have others found other issues since the upgrade? – orome Jul 28 '12 at 14:04

Depending on how the installation is performed, it may happen that the new system doesn't keep the necessary file in `/etc/paths.d`

The solution is simple: restore the file in the correct position. From a Terminal window, issue the following two commands

``````echo /usr/texbin > TeX
sudo mv TeX /etc/paths.d
``````

A logoff-login cycle should solve the issue.

## Update

With Mac OS X 11 (El Capitan) and TeX Live 2015 (or later), the first instruction should become

``````echo /Library/TeX/texbin > TeX
``````
• This solution continues to work in 10.11, though with SIP enabled, the path needs to be changed to `/Library/TeX/texbin ` rather than `/usr/texbin`. – orome Oct 17 '15 at 13:13
• It does not work on 10.11.2, after installing MacTex 2015 and tried the solution above with the two paths. In my case it 'worked' using the solution by Prashant Gaikwad. – Antonio Sesto Feb 22 '16 at 22:37
• @AntonioSesto Yes, with El Capitan one should use `/Library/TeX/texbin` instead of `/usr/texbin`, as said in the comment above. – egreg Feb 22 '16 at 22:59
• @egreg I did, it did not work. I used `/Library/TeX/texbin` in Texshop preferences and now Texshop works. Pdflatex is in my path since it runs in Terminal.app (simply executing `texshop`), but this was not enough to have TexShop find it. – Antonio Sesto Feb 22 '16 at 23:11
• @AntonioSesto That's a different matter: TeXShop has its own method for setting the path; the question was more general. – egreg Feb 22 '16 at 23:16

Just thought i'd add my two cents. egreg's solution is great but usage of paths.d and the path_helper is kind of discouraged in Mac OS X, at least when using ZSH and so that answer could not be working if paths.d is disabled.

I added `/usr/texbin` to my path and everything was happy.

To do that, I opened my `.zshrc` and appended `:/usr/texbin` to the line that defines my path. The line starts with: `export PATH=`.

• The problem now is how do you add `/usr/texbin/` to your path? :) Can you expand your answer? I believe it's interesting for those who set `zsh` as their default shell. Welcome to TeX.SX! – egreg Nov 12 '12 at 16:10
• Ok, updated with additional information. Thanks for the feedback! – Tyler Brock Nov 12 '12 at 18:42

Simple: Open TeXShop, select preferences under menu options, under that select Engine option, In that option change the tab Path settings to your texbin path, in my case it was `/usr/texbin` which I had to change to `/Library/TeX/texbin`.

That's it. No need to add any other paths any where else. It's already so user-friendly.

• Still works like a charm as of 1/8/2016 – Lee Mosher Jan 8 '16 at 20:02
• This solution works. – Antonio Sesto Feb 22 '16 at 22:38