Skip to content

Instantly share code, notes, and snippets.

@karnawhat
Created October 22, 2019 17:18
Show Gist options
  • Select an option

  • Save karnawhat/6b3b3f172c6d7baaad20360b9e364b1b to your computer and use it in GitHub Desktop.

Select an option

Save karnawhat/6b3b3f172c6d7baaad20360b9e364b1b to your computer and use it in GitHub Desktop.
Tutorial on installing BasicTeX

Installing BasicTeX

This is a barebones setup to using TeX with matplotlib. Since the whole MacTeX package is ~4GB, and includes a lot of unnecessary binaries, it is better to install BasicTeX and install the packages as you seem fit.

The easiest way to install is by running brew cask install basictex and run which pdflatex to check whether it is installed. This should return a path with the location of the filepath. If it doesn't, then check if the /Library/TeX folder exists.

Finally, add the following to your ~/.bashrc or ~/.bash_profile filepath: export PATH="/Library/TeX/texbin/:$PATH"

Adding packages

Now that you have installed BasicTeX properly, you need to install/add the following packages that matplotlib needs in order to generate the figures properly.

  1. type1cm
  2. dvipng
  3. etc.

These can be installed using tlmgr install <pkg-name>. Use sudo tlmgr install <pkg-name>if permission is denied.

Copy link

ghost commented Mar 12, 2024

Thanks, it works!

@alex-dinh
Copy link

alex-dinh commented Aug 21, 2025

Thanks. As of August 2025 (macOS Sonoma) I had to do:

brew install --cask basictex
sudo tlmgr update --self
sudo tlmgr update --all
sudo tlmgr install type1cm cm-super dvipng

Then, I put export PATH="/Library/TeX/texbin/:$PATH" in ~/.zshrc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment