Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Firing up Latex on macOS

Firing up LaTex on macOS 🔥

As I'm writing this small tutorial, I assume you've read my previous one about setting up macOS, so if for any tool I'll use without explanation, look to that other article.


The full version IS NOT MANDATORY, as in the tutorial that follows I installed the smaller version of MacTeX and proceded installing every needed dependency. Installing the complete package is about ~3.5GB of download and ~5GB on disk, the smaller one is just about 80MBs.

Click here to download the complete version or here to download the smaller version.


GnuPlot is a small library for drawing some kind of plots, I use it all the time.

brew install gnuplot


brew update && brew install imagemagick


Skim is a pdf viewer that syncs nicely with sublime text.

brew cask install skim

Packages commonly needed

What follows is a list of packages that are commonly needed (they are needed in our main project), they come installed with the ginormous package from MacTex, but I prefer a granular approach to avoid useless software. They can be installed all with the following command:

sudo tlmgr update --self
sudo tlmgr install latexmk subfiles ctablestack luacode luatex85 silence emptypage framed biblatex logreq xstring chngcntr sectsty minted fvextra ifplatform ifoddpage relsize relsize csquotes pgfplots circuitikz paralist enumitem glossaries datatool glossaries-english glossaries-italian glossaries-german mfirstuc xfor substr imakeidx fourier utopia quotchap soul collection-fontsrecommended algorithm2e xargs stanli preview standalone tikz-qtree

Here you can read to have an idea on the usage of each package:

Updating the package manager

First of all, we update the package manager as follows:

sudo tlmgr update --self


Latexmk is a tool used to build latex documents.

sudo tlmgr install latexmk


Subfiles is a package that allows to compile subfiles.

sudo tlmgr install subfiles


Ctablestack is a package that allows to render tables.

sudo tlmgr install ctablestack


Luacode is a package that allows to compile luacode in luatex.

sudo tlmgr install luacode luatex85


Silence is a package that allows to shush noise and useless warnings.

sudo tlmgr install silence


Emptypage is a package that allows to leave empty pages to separate topics.

sudo tlmgr install emptypage


Frames is a package that allows to frame theorems, definitions etc..

sudo tlmgr install framed


Biblatex is a package that allows to load bibliographies.

sudo tlmgr install biblatex


Logreq is a package that allows to automate some workflows.

sudo tlmgr install logreq


Xstring is a package that allows to automate workflows on string editing.

sudo tlmgr install xstring


Chngcntr is a package that allows to reset counters for images, equations etc...

sudo tlmgr install chngcntr


Sectsty is a package that allows you to apply custom styles to chapters and sections.

sudo tlmgr install sectsty


Minted is a package that allows you to highlight code.

sudo tlmgr install minted


Fvextra is a package that automates line breaks.

sudo tlmgr install fvextra


Ifplatform is a package that allows for if statements in latex for the various compilers (pdflatex, latex, lualatex...).

sudo tlmgr install ifplatform


ifoddpage is a package that allows to check if the current page is odd or even.

sudo tlmgr install ifoddpage


Relsize sets relative font size.

sudo tlmgr install relsize


Csquotes allows for automatic smart quotes.

sudo tlmgr install csquotes


Pgfplots allows compiling cool graphs.

sudo tlmgr install pgfplots


Circuitikz allows to draw circuits.

sudo tlmgr install circuitikz


Paralist allows for advanced lists.

sudo tlmgr install paralist enumitem


Glossaries allows to automate glossaries.

sudo tlmgr install glossaries datatool glossaries-english glossaries-italian glossaries-german


Mfirstuc allows to make first letter upper case.

sudo tlmgr install mfirstuc


Mfirstuc reimplements stronger latex "for" cycles implementation.

sudo tlmgr install xfor


Substr enables commands to check substring relationships.

sudo tlmgr install substr


Substr enables you to get info about the current language from babel or polyglossia.

sudo tlmgr install tracklang


Imakeidx builds automatically the index.

sudo tlmgr install imakeidx


Fourier extends the fonts enabled in amsmath.

sudo tlmgr install fourier utopia


Quotchap enables nice style for chapters.

sudo tlmgr install quotchap


Quotchap enables nice style for chapters.

sudo tlmgr install quotchap


Soul enables Hyphenation for letterspacing, underlining, and more.

sudo tlmgr install soul


Fontsrecommended is a collection of fonts commonly used.

sudo tlmgr install collection-fontsrecommended


([algorithm2e] Algorithm2e is a package to write pseudocode.

sudo tlmgr install algorithm2e


([Xargs] is a package that provides extended versions of \newcommand

sudo tlmgr install stanli


([Stanli] is a package to draw 2d and 3d structural analysis.

sudo tlmgr install stanli

Preview and Standalone

([Preview] and ([Standalone] are packages used to run math preview in latextools in sublime text.

sudo tlmgr install preview standalone


([Tikz-qtree] is a package to easily draw trees.

sudo tlmgr install tikz-qtree

Cpan & LatexIndent

Latexindent come with MacTex but can also be downloaded separately, when installed with the lightweight plugin, with the following commands:

sudo tlmgr option repository ctan
sudo tlmgr update --self
sudo tlmgr install latexindent

Just execute the command cpan in the terminal and follow its instruction. Then exit from the cpan ambient and install the following dependencies as follow:

sudo cpan -fi Log::Dispatch Log::Log4perl YAML::Tiny Getopt::Long File::HomeDir Unicode::GCString

Now exit from cpan and try running the command latexindent. Make sure that it runs.

Setup with sublime text

After following my guide over here we can continue here. Add to your package control settings these packages:


Shell escape

With packages such as minted you will need to enable shell escape. Just open up the package specific settings for LaTeXTools and add in the builder settings the following options:

"builder_settings" : {
    "display_log" : false,
    "options": [
    "osx" : {},
    "windows" : {},
    "linux" : {}

Get pygments

Pygments script is necessary for stuff like code highlight. You might have already this installed.

pip install pygmentize

If you have already installed it with Anaconda and your Tex editor does not find it, probably you need to create a link to the usr folder as follows:

sudo ln -s /anaconda3/bin/pygmentize /usr/local/bin/pygmentize

If the command fails you might need to look up for the current file position and create a link from there.

Adding usefull repositories

Adding BeautifyLatex

BeautifyLatex is a a package for sublime text that help format the latex code using latexindent. You need to add this by hitting super+maiusc+p and search for "Add Repository". Then you can add the package as usual, with super+maiusc+p and "Add Package".

Adding Dictionaries

Dictionaries adds multilanguage dictionaries for your latex projects. You need to add this by hitting super+maiusc+p and search for "Add Repository". Then you can add the package as usual, with super+maiusc+p and "Add Package".

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