[Tex/LaTex] Setting up BasicTex (Homebrew)

mactexpackagespdftex

Just getting started with TeX and I think I'm missing something…

I've installed BasicTex via Homebrew Cask (brew cask install basictex) which supposedly includes pdfTeX and a bunch of other tools (MetaFont, dips, MetaPost, etc.), but when I run pdflatex I get 'Command Not Found'.

Is there additional setup required here? (tlmgr?)

(On Mac OS X 10.11.4)

Best Answer

Update:

As noted by Dorian, brew cask is now smart enough to run the installer:

$ brew install --cask basictex
==> Downloading http://mirror.ctan.org/systems/mac/mactex/mactex-basictex-20180417.pkg
==> Downloading from http://ctan.math.washington.edu/tex-archive/systems/mac/mactex/mactex-basictex-20180417.pkg
######################################################################## 100.0%
==> Verifying SHA-256 checksum for Cask 'basictex'.
==> Installing Cask basictex
==> Running installer for basictex; your password may be necessary.
==> Package installers may write to any location; options such as --appdir are ignored.
Password: <prompts for password>
installer: Package name is BasicTeX-2018
installer: Installing at base path /
installer: The install was successful.
🍺  basictex was successfully installed!

Again, however, the newly installed binaries won't be in your $PATH until you open a new terminal window or new login shell.

$ which pdflatex
$ pdflatex
-bash: pdflatex: command not found
$ bash --login
Restored session: Thu Nov 29 10:19:33 PST 2018
$ which pdflatex
/Library/TeX/texbin/pdflatex

Original answer (2016-07):

brew install --cask basictex just downloads the .pkg installer, which you then need to open so it can install itself.

$ brew install --cask basictex
==> Tapping caskroom/cask
Cloning into '/usr/local/Library/Taps/caskroom/homebrew-cask'...
remote: Counting objects: 3781, done.
remote: Compressing objects: 100% (3728/3728), done.
remote: Total 3781 (delta 73), reused 627 (delta 32), pack-reused 0
Receiving objects: 100% (3781/3781), 6.51 MiB | 666.00 KiB/s, done.
Resolving deltas: 100% (73/73), done.
Checking connectivity... done.
Tapped 1 formula (3,747 files, 15.4M)
==> Creating Caskroom at /usr/local/Caskroom
==> Downloading http://mirror.ctan.org/systems/mac/mactex/mactex-basictex-20160523.pkg
######################################################################## 100.0%
==> Verifying checksum for Cask basictex
==> Running installer for basictex; your password may be necessary.
==> Package installers may write to any location; options such as --appdir are ignored.
Password:⚿
==> installer: Package name is BasicTeX-2016
==> installer: Installing at base path /
==> installer: The install was successful.
🍺  basictex staged at '/usr/local/Caskroom/basictex/20160523' (105M)

You can see where it was download ("staged") at the end of the brew cask output (as above); locate in the Finder and double-click, or just use open.

$ ls /usr/local/Caskroom/basictex/20160523
mactex-basictex-20160523.pkg
$ open /usr/local/Caskroom/basictex/20160523/mactex-basictex-20160523.pkg

BasicTeX installer window

If you now try to find, say, pdflatex in the same Terminal window, it won't be in your $PATH:

$ which pdflatex
$ pdflatex
-bash: pdflatex: command not found

Open a new one, however, and you'll find it in /Library/TeX/texbin.

Last login: Fri Jul 15 08:35:43 on ttys001
$ which pdflatex
/Library/TeX/texbin/pdflatex

And you're good to go.