I'm working in TeXShop on my mac and I love it.

There is one slight problem though. I use TikZ wich sometimes uses gnuplot to create it's plots. One would think that running TeXShop alone is enough (TeXShop should call gnuplot) but it isn't for me.

I have to run my file from the command line using:

latex -shell-escape myfile.tex

and only after I did this the plot's will appear in TeXShop. What happens is this:

  1. TeXShop can't find or call gnuplotso it doesn't create the necessary *.table files
  2. If I call latex from the command line, it automagically does find gnuplot and creates the correct *.table files
  3. When I run TeXShop again, the *.table files are already there and it just picks them up to work with.

I thought this was normal, until I discorvered it wasn't by using another package that also needs to call an external program (minted, which needs pygmentize and/or python). This package works normally from my TeXShop and this got me thinking: should calling gnuplot from TeXShop work just as well?

I'm guessing it has something to do with the location of my gnuplot, using which gnuploton the command line tells me it is in:


It got installed there using the installtion guide here (actually, I installed all the macports, and gnuplot was one of them).

Readings in some other fora lead me to believe the symbolic link is broken.. Although I don't quite know what that means or how to fix it. TeXShop doesn't know where to find gnuplot.

What should I do to fix this?

PS: to avoid the obvious question: yes, --shell-escape is enabled in my TeXShop preferences.


You should either tell TeXShop to use /opt/local/bin/gnuplot instead of gnuplot, or add /opt/local/bin to the PATH that graphical applications see under Mac OS X. For the latter, you should have to edit (or create) the file ~/.MacOSX/environment.plist, see http://www.astro.washington.edu/users/rowen/AquaEnvVar.html.

The following should work in your case, but make sure you also add the directory where the tex binaries live

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">

Don't forget to logout and login again for the changes to take effect.

|improve this answer|||||
  • 1
    Hi for me it was not nessasary to add a plist-path. Adding the path to $PATH by editing local .bashrc did work fine for me. Open .bashrc and add export PATH=$PATH:/opt/local/bin – bloodworks Mar 3 '11 at 9:26
  • in ~ wich is also konwn as /Users/yournamehere/ if bashrc resp. .bash_profile is not there you may create it. Remember: files beginning with . are hidden files you need to say ls -a to get them listed. If .bash_profile is present, everything else is ignored. Depending on your configuration it might be necessary to set the PATH either in .bash_profileor profile or another rc-file. Per defualt you should find a .bas_profile in your home-dir. If so, try to set your PATH here. Sometimes its helpful to add a echo "This is .bash_profile read in!" on top of the file. – bloodworks Mar 3 '11 at 10:44
  • @bloodworks thanks, but it worked using cefstats' method. It didn't work just adding the lines though, I had to input the stuff between <string> and </string> using the mac os plist editor. – romeovs Mar 3 '11 at 10:46

Another method is to create a symbolic link so that TeXShop finds it in the place it's looking. In a Terminal window execute:

$ sudo ln -s /opt/local/bin/gnuplot /usr/local/bin

(the $ is the prompt, not something to execute.)

|improve this answer|||||
  • I tried this before but it didn't work. Might be I did something wrong though. – romeovs Mar 3 '11 at 14:27
  • At the time I had this problem I tried modifying the $PATH and it didn't work for me. But like you, I may have been doing something wrong. :-D – Matthew Leingang Mar 3 '11 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.