How do I install MacTex or another LaTeX distribution?

Even after installation, LaTeX commands like latex, pdftex or lualatex are not found, and /usr/texbin/ doesn't exist.

Even worse, commands like sudo mkdir -p /usr/texbin return "permission denied"

closed as off-topic by egreg, user31729, user13907, R. Schumacher, Mike Renfro Jun 12 '15 at 23:54

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center." – egreg, Community, Community, R. Schumacher, Mike Renfro
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    You did see on the MacTeX list that this has been addressed for the release version of TL'15, I assume? – Joseph Wright Jun 12 '15 at 18:51
  • No, I didn't. I fixed my issue literally minutes before the new release and didn't check for an update since. – LaX Jun 12 '15 at 21:14
  • In general we tend not to take questions on pre-release versions of software. Normally, of course, that's from the 'TeX end' where feedback from people here might influence the code. Whilst that's less likely with an OS, the same position might seem reasonable. – Joseph Wright Jun 12 '15 at 21:38
  • Further to my earlier comment, see the 'PS' in article.gmane.org/gmane.comp.tex.macosx/47074 and in particular the statement about behaviour on El Capitan. – Joseph Wright Jun 12 '15 at 21:47
  • 6
    The help center allows questions about "Distributions like ... MacTeX". The question is relevant to many users, and this forum is the most suitable place to find help. I can't see why the question was marked "off-topic", except perhaps that some people don't like Apple. – Jairo Bochi Sep 30 '15 at 14:44

The new Mac OS comes with a feature named "rootless" that disallows modification of important system files, even by the root user.

However, LaTeX installation requires access to the /usr/texbin folder, at least as an alias, and it is protected by Mac OS.

There are two solutions:

1) Disable the rootless feature

To disable the rootless feature at boot, run this command:

sudo nvram boot-args="rootless=0 kext-dev-mode=1"

Reboot, and then run:

sudo ln -s /Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin /usr/texbin

if you already installed LaTeX from MacTex

2) Edit your $PATH

If you don't want to disable the rootless feature, you can just modify your $PATH to point to the location of your LaTeX installation.

For MacTex, files are located under /Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin, so the following command in your .bash_profile should work:

export PATH=$PATH:/Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin
  • See article.gmane.org/gmane.comp.tex.macosx/47074 Substitute /usr/texbin in the PATH with /Library/TeX/texbin – egreg Jun 12 '15 at 19:24
  • @Johannes_B Even the mactex installer? I don't remember having that ability, though I haven't tested much on mac – daleif Jun 12 '15 at 19:25
  • @daleif I just assumed it would be the same, i actually never used a mac. I deleted my comment just in case it is false information. – Johannes_B Jun 12 '15 at 20:07
  • 2
    ^ Note that the above method for "disabling rootless" has already been deprecated. The newest official method (as of Sep 2, 2015 at least) is to restart your mac while holding Cmd + s. This will boot into the recovery partition. Once loaded, go to the menu at the top of the screen and select "Security Configuration". This will open a dialogue box with only one checkbox that allows you to disable "System Integrity Protection". – Nick Sep 3 '15 at 1:31
  • 1
    While I'm at it... know that once you have rebooted, you can then add or remove the restricted flag to various files. The restricted flag prevents the file (or directory) from being modified when System Integrity Protection is enabled. To add the flag, run chflags restricted file. To remove, run chflags norestricted file. To see the flags in a directory run ls -lO (that's lowercase "ell" and uppercase "oh"). I'm sick of Googling stuff and not finding everything I need in one spot, so future Googlers wondering about SIP, there ya' go. – Nick Sep 3 '15 at 1:40

Mac OS X El Capitan is not for public consumption

  1. This is a beta release, and not public at this point (i.e., you likely signed an NDA to get it)
  2. All features are subject to change, and mucking around in nvram is inadvisable unless you really know what you're doing

A corollary to my second point: if you know what you're doing, you should ask on Apple's private forums or come up with your own workaround, because it's not a hard problem to solve.

  • 1
    I thought from what I'd seen the release was (relatively) accessible at this stage – Joseph Wright Jun 12 '15 at 21:23
  • This is not an answer dealing with the question, this is basically a disclaimer. Why didn't you add it to my answer? – LaX Jun 12 '15 at 21:23
  • 1
    @LaX As we are talking about pre-release software it's as good an answer as any. Indeed, the question might well be closed as in general we take the line that pre-release or other testing versions are off-topic. – Joseph Wright Jun 12 '15 at 21:25
  • 1
    @JosephWright I'll argue that while this is indeed a pre-release software that is subject to change, this is the issue with installation that matters. The fact that Mac OS 10.11 is pre-release isn't relevant to TeX – LaX Jun 12 '15 at 21:38
  • Added as a separate answer to make it more obvious that I think the question should be closed. @JosephWright there will supposedly be a public beta in July; AFAIK at present it's limited to paying developers and seed testers under NDA. If I'm wrong on that last, I'd be happy to delete this answer. – Adam Maxwell Jun 12 '15 at 22:43

Not the answer you're looking for? Browse other questions tagged or ask your own question.