112

I'm trying to convert Jupyter notebook to .pdf on Mac.

However, it tells me

nbconvert tailed: pdflatex not found on PATH

So, I went looking around and someone said, "Install mactex because this other way takes days to compile". So I did brew install Caskroom/cask/mactex and it finished without telling me there was a problem, but unfortunately it didn't install pdflatex that I can gather. And 'mac install pdflatex' doesn't bring anything useful up on Google for me maybe my bubble sucks.

How do I install pdflatex on my mac?

karel
  • 13,706
Wayne Werner
  • 2,463

4 Answers4

106

Install BasicTeX

To get pdflatex for Pandoc on macOS, install BasicTeX. Many people recommend MacTeX, which is a much bigger package than you need. BasicTex is produced by the same people who make MacTeX, but without, e.g., the GUI applications that make it so slow to download and install.

  1. $ brew install basictex
  2. Restart Terminal.
  3. Convert LaTeX to PDF.

Example

Say you want to convert LaTex to PDF with Pandoc. You'd write:

  1. $ pandoc sourcefile.tex -o output.pdf, which fails with error pdflatex not found. Please select a different --pdf-engine or install pdflatex.
  2. So you install BasicTex, $ brew install basictex.
  3. Then restart your Terminal, and
  4. Run $ pandoc sourcefile.tex -o output.pdf again. Success!
Honey
  • 105
  • 4
Merchako
  • 2,864
  • 4
  • 20
  • 17
62

Yes, same story with my MacOS Sierra:

(1) installed mactex with homebrew cask, but no pdflatex found after that:

$ brew cask install mactex

$ which pdflatex

[no location]

(2) relaunched the terminal app

(3) pdflatex found:

$ which pdflatex

/Library/TeX/texbin/pdflatex

31

It appears that brew does not, technically speaking, install mactex. It just downloads it.

I had to use the quick launch and type in mactex which popped up an installer.

After it finished I pdflatex existed, though I did have to start up a new shell - I'm assuming it did something to my path.

Wayne Werner
  • 2,463
0

Sometime later and working on a mac I also could not get pdflatex to produce a PDF. What worked for me was firstly realising that my TEX file was expecting to be compiled with xelatex and then finding a suitable Docker image, such as https://github.com/jpbernius/docker-xelatex

This doesn't answer the second part about installation, but may help someone who just needs a PDF.

snow6oy
  • 101
  • 2