tadasajon
tadasajon

Reputation: 14836

pandoc via launchd -- getting error: "pdflatex not found. pdflatex is needed for pdf output

I am trying to generate a pdf document from a markdown document every 90 seconds. I have set up a task in launchd to handle this for me. Unfortunately, I am getting an error announcing that pdflatex can't be found even though I can invoke it from the command line. Here is the entire contents of ddd_publisher.sh, which is the file that launchd runs every 90 seconds:

/usr/local/bin/pandoc -o /Users/Jon/dev/intercontinental/ddd.pdf /Users/Jon/dev/intercontinental/ddd.ddd

The program runs every 90 seconds, but it writes the following line to stderr:

pandoc: pdflatex not found. pdflatex is needed for pdf output.

If I type pdflatex -v at the command line it tells me that it is installed:

pdfTeX 3.1415926-2.4-1.40.13 (TeX Live 2012)

Here is my launchd plist file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>ddd.intercontinental.publisher</string>
<key>ProgramArguments</key>
<array>
    <string>/Users/Jon/dev/intercontinental/ddd_publisher.sh</string>
</array>
<key>StandardErrorPath</key>
<string>/Users/Jon/dev/intercontinental/ddd.stderr</string>
<key>StandardOutPath</key>
<string>/Users/Jon/dev/intercontinental/ddd.stdout</string>
<key>StartInterval</key>
<integer>90</integer>

Upvotes: 3

Views: 3683

Answers (1)

tadasajon
tadasajon

Reputation: 14836

The solution was to add the path for pdflatex to the bash script, as follows:

#!/bin/bash
PATH=$PATH:/usr/texbin
/usr/local/bin/pandoc -o /Users/Jon/dev/intercontinental/ddd.pdf /Users/Jon/dev/intercontinental/ddd.ddd

Upvotes: 4

Related Questions