[Tex/LaTex] Install Gnuplot on Mac OS-X 10.8.2 for use with ‘tkz-fct’ package

gnuplottikz-pgf

I have recently discovered the TikZ packages for LaTeX:
http://altermundus.com/pages/tkz/index.html

I have run the examples for tkz-euclide with success.

I would also like to use the tkz-fct package for plotting curves.
Since I have not previously installed Gnuplot, when I compile examples using the tkz-fct package I get the error message: Plot data file `filename.tkzfct.table' not found.

I have read several web pages that describe how to compile the source for Gnuplot for Mac OSX and also some explanations on how to obtain binaries as part of other packages such as Octave and others. I have not tried these procedures yet, as they seam complicated and I am a novice at Mac OSX details.

What is the best practice for how to install Gnuplot for use with TexShop with MacTex 2012 distribution, on Mac OS-X 10.8.2 Mountain Lion for use with 'tkz-fct' package.

I apologize if a similar question was answered already, but there are so many different answers and many are a few years old.

Best Answer

Most of the the answer to this is contained in the following question:

However, depending on how your system is set up you may need to do some extra things.

First, compiling source code on a Mac requires you to install XCode from the App store (it's free). See the following link for a nice description:

Second, you also need to allow TeX to run external programs like GnuPlot. Typically the way to do this is to run programs with the --shell escape option. However, recent version of TeX Live have created a system of so-called "restricted" shell escape, which allows you to add programs to a global list of external programs to minimize the security issues of using unrestricted shell escape.

There are a number of different ways to implement this on a Mac.

Create a TeXShop engine file for --shell-escape

The simplest way is probably to create a new TeXShop engine file which runs the appropriate LaTeX command with the --shell-escape option enabled. See:

Create a config file in your texmf-local folder

If you are using gnuplot capabilities a lot, it might be easiest to add gnuplot to your list of allowable programs. This can be done by creating a local texmf.cnf file. Create the following file:

shell_escape_commands =     bibtex,bibtex8,    kpsewhich,    makeindex,    mpost,    repstopdf,    gnuplot,

The file must end with a blank line. Save or copy this file into the following directory: (you will need administrator access to do this.)

/usr/local/texlive/texmf-local/web2c

Then run texhash to update the TeX database.

Now you should be able to use gnuplot from within your TeX documents.