I have to draw a lot of PDF and CDF graphs in my document/presentation and in order to do that I installed gnuplot. In order to install gnuplot I took the following steps:

1- Download the sources from : gnuplot sources then put the folder gnuplot-4.4.3 on my desktop 2- $ cd /Users/.../Desktop/gnuplot-4.4.3 3- $ ./configure --with-readline=builtin 4- $ make 5- $ sudo make install 6- test of gnuplot $ gnuplot gnuplot works from Terminal. However, I get a lot of error running the followingMWE


% to be used: \cdf(x)(mean)(variance)


    \addplot[smooth,red] gnuplot{\cdf(x)(0)(1)};

The error that I get is

pgfplots: Sorry, the gnuplot-result file 'texstudio_DH7974.pgf-gnuplot <file>.gnuplot' manually on the respective gnuplot file.. \addlegendentryexpanded{$k = \k$}}

or code given in plotting chi-square. I guess I am missing one (or maybe cuple) of steps installing gnuplot. I really appreciate if you help.

  • 2
    You need to run your pdflatex command with the --shell-escape option. Can you check your TeXStudio preferences to see if that's the case?
    – Alan Munn
    Commented Dec 17, 2012 at 3:00
  • 1
    See Commands paths in TeXstudio on Mac OS X - with 'could not start the command' error and try adding --shell-escape to the line for pdflatex.
    – Alan Munn
    Commented Dec 17, 2012 at 3:11
  • Thanks a million @AlanMunn: It works beautifully! For the future reference, in TexStudio preferences, under Commands, PdfLaTeX is /usr/texbin/pdflatex -synctex=1 -interaction=nonstopmode -shell-escape %.tex. Again, THANK YOU!
    – N Nik
    Commented Dec 17, 2012 at 3:25
  • @AlanMunn: Can you please turn this into an answer, then I can accept it? Thank you
    – N Nik
    Commented Dec 17, 2012 at 3:26

1 Answer 1


Since you can run gnuplot from the Terminal, you have installed it correctly. But you also need to configure pdflatex to allow it to run external programs. Since you are using TeXStudio you need to go into its preferences and change the entry for pdflatex. See

for details on this. So the correct line to allow you to run gnuplot from within a LaTeX document is:

 pdfLaTeX    "/usr/texbin/pdflatex" -synctex=1 -interaction=nonstopmode -shell-escape %.tex    
  • 2
    Well, I'm in a very similar situation, and this command doesn't work for me. I have Mountain Lion 10.8.2, with TeXworks, TeXShop and TextMate. I installed gnuplot from MacPorts (and it works from the terminal). If I call it from any of those three programs it gives me an error (and I have to manually execute gnuplot from the terminal). I don't know what happens (it worked well in Snow Leopard).
    – Manuel
    Commented Dec 17, 2012 at 17:30
  • 1
    @Manuel This sounds like a path problem. Do you get the same error as above, or something different?
    – Alan Munn
    Commented Dec 17, 2012 at 18:23
  • 1
    Package pgfplots Error: Sorry, the gnuplot-result file 'untitled.pgf-plot.table' could not be found. Maybe you need to enable the shell-escape feature? For pdflatex, this is '>> pdflatex -shell-escape'. You can also invoke '>> gnuplot .gnuplot' manually on the respective gnuplot file. How can I solve that PATH problem (it's true, TextMate usually asks to set PATH, but this time it didn't).
    – Manuel
    Commented Dec 17, 2012 at 18:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .