Defining a $PATH

Upcoming changes to OS X have caused us to make some changes in TextMate that have been causing some users to see a env: ruby18: No such file or directory error when running bundle items. This is caused by improper setup of the PATH variable, but lets go over what this variable does and how to correct the issue.

OS X comes with many command line tools that TextMate takes advantage of such as ruby, python, git, etc. To find these programs there is the environment variable PATH which is a list of paths that is used to find the required tools.

Note that while you may already have set the PATH variable for your shell (e.g. bash) it is not inherited in TextMate, as TextMate does not parse your shell setup scripts. For commands that require tools outside the default path list, like the LaTeX typeset command, we normally provide a list of common locations that TextMate should also search, so you normally should not need to change the PATH in TextMate.

To add to the PATH variable inside TextMate open Preferences and go to the Variables section and add a new item with the name of PATH. It is important that the value set augment the existing value instead of replacing it. To do this you should prefix the value with $PATH:. Example values for common uses:

MacPorts: $PATH:/opt/local/bin

Homebrew: $PATH:/usr/local/bin

This post relates to TextMate 2.0 only.