Table of Contents
Install and run LaTeX on macOS done in four easy steps:
- Install Homebrew
- Install pdflatex with Homebrew
- Install more LaTeX packages with tlmgr
- Compiling LaTeX with a Makefile
Check out more blogs:
- WP QuickLaTeX for Running LaTeX on WordPress
- Your Life as a Beautiful Mosaic
- Engineering Mindset: Be a Stone Carver, Not a Brick Mason
Homebrew is a package manager for mac. You can get the latest installation instructions for Homebrew at their website brew.sh.
At the time of writing (December 2021) the installation command is:
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Follow the command prompts to install Homebrew.
Install pdflatex with Homebrew
pdflatex is a command line utility which converts raw .tex files into a PDF document. Once Homebrew is installed you can then install
$ brew install pdflatex
If Homebrew can’t find pdflatex, try installing BasicTeX:
$ brew install basictex
Install More Packages with tlmgr
tlmgr is the package manager bundled with
pdflatex. First update
$ sudo tlmgr update --self
Then install all of the extra packages:
$ sudo tlmgr install collection-latexextra
You may get some warning messages at the end, but double check to see make sure there are no errors which stopped the install of the packages.
Compiling LaTex with a Makefile
A Makefile simplifies the compilation of the LaTeX into a PDF with a single command. First create the following file named
bibtex filename # remove if no references/bibliography
pdflatex filename.tex # remove if no references/bibliography
open filename.pdf &
rm -f *.pdf *.aux *.log *.toc *.blg *.out *.bbl
Note that you will need to remove the
bibtex line (and third compilation) if your LaTeX does not have references or a bibliography. Now run the makefile and it will compile and open the PDF:
$ make filename
You’re all done!
Check out more blogs:
I tried running brew install pdflatex, but got this error:
Warning: No available formula with the name “pdflatex”. Did you mean pdf2htmlex?
Looks like you updated this page last month, so how could pdflatex not be found?
I definitely can’t use pdf2htmlex; pandoc won’t accept it.
Hey Rick, thanks for commenting. Not sure why pdflatex didn’t show up in homebrew for you. Try installing basictex with homebrew:
$ homebrew install basictex
This should give you the pdflatex executable and the rest of the instructions will apply. Let me know if that worked.
Thank you for this. This is exactly what I needed.