15

I've noticed that my PATH variable includes /usr/texbin, as it should, but I can't find any bash files that modified my PATH variable to include it. How did the TeXLive installation modify my PATH variable upon installation without modifying any bash files?

I'm running Mac OS X 10.7, TexLive 2011. The only bash files I can find are:

~/.profile,
/etc/bashrc,
/etc/profile.

None of these contain any modifications to PATH that include /usr/texbin.

Can anyone educate me?

Alan Munn
  • 218,180
Ryan
  • 151
  • 1
  • 1
  • 3
  • The answers to this question have been updated to reflect changes in the MacOS. The path for TeX binaries is now /Library/TeX/texbin not /usr/texbin. The question itself remains valid, however. – Alan Munn Jan 04 '18 at 22:25

2 Answers2

26

MacOS X has an additional mechanism to add to the path. If you read /etc/profile you will find the lines

if [ -x /usr/libexec/path_helper ]; then
        eval `/usr/libexec/path_helper -s`
fi

The path_helper program uses the directory /etc/paths.d to add items to the path. Inside /etc/paths.d, each file should be a list of items to add to the path. So there is a file there called TeX which contains one line

/Library/TeX/texbin

It is this line which makes the 'magic' work. See http://www.softec.lu/site/DevelopersCorner/MasteringThePathHelper for more on this.

Alan Munn
  • 218,180
Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036
9

On OS X (since 10.5) the basic path is constructed via the list contained in the file /etc/paths plus local additions stored in /etc/paths.d. Inside /etc/paths.d is a file TeX, which contains /Library/TeX/texbin (or /usr/texbin on much older distributions). This is what is added by MacTeX. If you happen to have X11 installed on your machine, you will also find an X11 file in paths.d (Under Mavericks, this will be 40-XQuartz instead.)

Of course, you can add your own additions to the path in your .profile as usual; but for systemwide paths, you can simply add another file to the /etc/paths.d directory.

Alan Munn
  • 218,180