Yearning for A Clean Environment

The $PATH variable in my dev server is full of old paths added via various tutorials over the months since last OS clean install, and I want to know what the source of each of the items is.

Let’s see, we’ve got the ~/ directory which contains:
.bash_profile


#export PATH
export PATH=/usr/local/bin:$PATH

# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH

#Settings for virtualenvwrapper
export WORKON_HOME=~/Envs
mkdir -p $WORKON_HOME
source /Library/Frameworks/Python.framework/Versions/2.7/bin/virtualenvwrapper.sh

# Setting PATH for Python 3.4
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
export PATH

And .bashrc:

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting

### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"

And .profile, which just has one commented out line

#PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting

Then there’s the /etc/ directory with:
paths:


/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
/opt/local/bin
/opt/local/sbin

and paths.d which is a directory containing two files:
X11: /usr/X11/bin
git: /usr/local/git/bin

But I think this directory is actually creating aliases, with the alias being the name of the file and the path within the directory being the referent of the alias. You can add an alias to it thusly:
sudo sh -c 'echo /usr/local/mysql/bin > /etc/paths.d/mysql'

And here’s what it all adds up to:

echo $PATH
/Library/Frameworks/Python.framework/Versions/3.4/bin:
/Library/Frameworks/Python.framework/Versions/2.7/bin:
/usr/local/bin:
/Users/mikekilmer/.rvm/gems/ruby-1.9.2-p320/bin:
/Users/mikekilmer/.rvm/gems/ruby-1.9.2-p320@global/bin:
/Users/mikekilmer/.rvm/rubies/ruby-1.9.2-p320/bin:
/Applications/MAMP/bin/php/php5.5.3/bin:
/usr/bin:
/bin:
/usr/sbin:
/sbin:
/usr/local/bin:
/opt/local/bin:
/opt/local/sbin:
/usr/local/git/bin:
/usr/X11/bin:
/Users/mikekilmer/.rvm/bin