random thoughts

How to install BasicTeX on MacOS via homebrew

· Rafał

If you want to install latex on your Mac you have two most common options - install Full MacTeX or smaller distro - Basic TeX. See package listing here. The first option is easy, but package weights few gigabytes of data you probably won’t use anyway. The second one might be problematic for latex newbies like me, so here are some scribbles that hopefully might help someone.

  • You can install BasicTeX directly from the console if you have homebrew installed via brew cask install basictex.

  • it comes with tlmgr - the native TeX Live Manager and probably you will need to install some missing packages via sudo tlmgr install <package>. I suggest installing collection-fontsrecommended right away. Extra tip: if you will encounter something like Package fontenc Error: Encoding file 'ly1enc.def' not found. (fontenc) just install ly1 package to solve it - it wasn’t obvious to me at first. You can look up packages online here.

  • I had to manually modify PATH on my fish shell after installation by adding set PATH /Library/TeX/texbin/ $PATH in ~/.config/fish/config.fish (reload shell and check if you can use pdflatex for example).

  • You can compress generated pdfs further via Ghostscript (code stolen from stackoverflow):

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

or you can check out pdfsizeopt.