# 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? –  raxacoricofallapatorius 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.

-

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