While there are many guides on how to set and edit Mac OS X environment variables, there are some programs that add variables to your
$PATH
in Mac OS X that normally don't even notify that they've changed your path, simply because they expect to be needed in the path,
or because other programs won't function without them there. Regardless, while you COULD use ~/.MacOSX/environment.plist
, ~/.bashrc
, or ~/.profile
, you should always be aware of the /etc/paths
& /etc/paths.d/
entries. These are simply text files with listings of directories, one per line, to append to the $PATH
variable.
I noticed that my $PATH
was a bit cluttered and unnessessarily long when I ran echo $PATH
, seeing locations that didn't exist and
programs that I've either removed or updated. From what I can tell, only Mac OS X does this, and Apple does't even mention it in their
documentation of how to set environment variables. If you notice anything strange in your $PATH, be sure to sudo vi /etc/paths /etc/paths.d/*
and
make sure the entries are things you do need in your path.
Having a long $PATH with locations that don't exist can slow down the time it takes for the Terminal app to start. I removed the dead entries and noticed an immediate change when I ran the Terminal again.
- Note: This serves both as a guide and as a self-reminder about this particular property of Mac OS X.