Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm using LaTeX pdfTeX 3.1415926-1.40.9-2.2 on Mac OSX 10.6. When I try to build from TextMate (Ctrl+R) I get the following error:

Please add the directory containing “kpsewhich” to PATH in TextMate's Shell 
Variables preferences. 
share|improve this question
Just to be clear: you are using Textmate to run a shell? –  Charles Stewart Nov 9 '10 at 7:14
which OS and which LaTeX distribution? –  Juan A. Navarro Nov 9 '10 at 12:00

4 Answers 4

up vote 7 down vote accepted

open up the file ~/.bash_profile and add the following to the end

export PATH

This should patch the issue.

NOTE: To open the ~/.bash_profile open terminal and type mate ~/.bash_profile or vim ~/.bash_profile


  • mate is the command line or bash call to TextMate.
  • vim is the bash call to vim (an command line editor).
  • ~ is the bash reference to your home directory.
  • a . before a file is UNIX's (What OSX runs on) way of specifying a hidden file, which is why you can't see the .bash_profile in your home folder.
share|improve this answer
Hey Ban, How do you open up the file ~/.bash_profile? –  Helen Nov 13 '10 at 3:30

How about: go to 'Preferences' in TextMate, and add /usr/texbin to the PATH in the 'Shell Variables'? After all, that is what TextMate itself suggests ...

share|improve this answer
Adding that path directly to your bash profile makes LaTeX, TeX, etc accessible not only from TextMate, but also from Terminal or any other program that accesses programs through the command line. –  Ben Nov 15 '10 at 22:27

Neither of these path-setting options worked directly for me. Not even after restarting Textmate 2.

However, I noticed that there was a little check box next to the PATH - the first line in Textmate - Preferences - Variables. Checking that box immediately resolved the problem. I had previously run

which kpsewhich

from the command prompt and added its path to both ~/.bashrc and the PATH text value. That editing that field didn't automatically check the box or ask if I wanted it checked is well just one of those things that might have been nice for the developers to have thought of as being useful.

share|improve this answer

I had the same error message. In my case I did the following which solved the problem :

  1. Locate kpsewhich using find / -name kpsewhich* -print. In my case, the kpsewhich executable is located at /usr/local/texlive/2008/bin/universal-darwin.

  2. Add the path to the PATH variable in TextMate. In TextMate go to Preferences... > Advanced > Shell variables. Add :/usr/local/texlive/2008/bin/universal-darwinto the existing value of PATH variable.

  3. Do cmd+r and it worked. No need to restart anything.

share|improve this answer
Welcome to TeX.SX! –  Adam Liter Sep 7 '14 at 15:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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