Error with latexmk

I’m unsure how to proceed: on my iMac, producing a pdf file from a General Non-Fiction (latex) template works fine, but on my MacBook I get an error:

'/var/folders/c9/h0vzh5yj689b1ggyb7n1ny_w0000gn/T/my-script: line 3: latexmk: command not found'

I edited the script to use pdflatex on both machines. Help is appreciated.


Could it be the other Mac is using a different LaTeX distribution? I set up that script to work with MacTeX (which is by and large a wrapper for TeX Live), so in theory it should work on any machine with that installed. Another possibility is that the other machine is older, and the texbin is in another location (they had to move it a while back to get around the changes Apple made to the UNIX subsystem).

If it is in a different location than /Library/TeX/texbin, then change the Environment setting in your Processing pane to match.

If you’ve used the minimal MacTeX installer (, you do not get latexmk by default, and need to install it (so perhaps one machine used it and the other used the full installer?). You can easily install it with:

 sudo tlmgr install latexmk

Or if you prefer a GUI, then TeX Live ( is great, and can easily be installed if you use Homebrew:

brew cask install tex-live-utility

Both tools allow you to easily keep your TeX install up-to-date…

Thanks a lot, AmberV and nontroppo, I will give this a try.