# MacTeX Error: XeLaTeX: command not found

Now here is the thing. I upgraded my Mac to the OS X EI Capitan a few days ago. And now MacTeX is not working. When I try to typeset it, the console shows the following error:

xelatex: command not found.

How can I fix it?

## 2 Answers

this is due to the new permission settings on Mac OS X El Capitàn. Here you can find a way to configure everything properly.

In that page (from which I copy), we find that

Cause of the problem: MacTeX installs a symbolic link /usr/texbin pointing to the TeX binaries. GUI applications use this link to find the binaries. But in El Capitan, the location /usr is reserved for Apple, and even users with root access are not allowed to write to that location.

Solution: The solution to this problem is to relocate the link to /Library/TeX/texbin, and reconfigure GUI applications to look in this location. Consequently, MacTeX-2015 and BasicTeX-2015 write two links, /usr/texbin and /Library/TeX/texbin, when installing on systems earlier than El Capitan, and write /Library/TeX/texbin when installing on El Capitan. These installations configure shell applications to look for TeX in both locations. You, therefore, need only to reconfigure GUI, as instructed here.

Reconfiguring TeXLive Utility: Version 1.23 of TEX Live Utility automatically detects the loss of /usr/texbin under El Capitan and prompts the user to automatically fix the problem. Previous versions need manual fixing:

• Open TeXLive Utility Preferences
• Click on Choose...
• Press Shift + cmd+g
• Enter /Library/TeX and click ok
• Double click on texbin

Reconfiguring TeXShop: As pointed out in this document, TeXShop versions from 3.52 onwards (July 2015) automatically redirect themselves to the correct link; if you cannot/want not update, you should:

• Open TeXShop Preferences
• Go in the Engine tab
• Change the Path settings for (pdf)TeX from /usr/texbin to /Library/TeX/texbin

And you should be good to go.

Reconfiguring LaTeXit:

• Open LaTeXit Preferences
• Go under Typesetting - Behaviour
• Change all paths that start with /usr/texbin with /Library/TeX/texbin

Reconfiguring TeXWorks:

• Go on the TeXWorks Preference, Typesetting Pane
• click on the + button in the Paths for TeX
• Click on the popup menu and select your hard drive
• Double-Click on Library and then TeX
• Click on texbin to select it and Click on the Choose button to add /Library/TeX/texbin. You can delete the /usr/texbin item by selecting it and clicking one the - button.
• Would you mind expanding your answer and including the information that you only linked? If the link were to be invalid in the future, then this answer would be useless. – Tom Bombadil Oct 21 '15 at 11:09
• I tried adding some of the most valuable parts. I don't know if a copy and paste of the whole document is the right way to go... – Moriambar Oct 21 '15 at 11:33

In my case after installing MacTex (on El Capitan) I was able to get a result for xelatex --version in a new terminal window but not in the existing one running jupyter notebook (after canceling the running instance).

Solution: Close the terminal running jupyter open the terminal again test if xelatex --version works now and run your jupyter notebook or whatever command again