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:

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

# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
export PATH

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

# Setting PATH for Python 3.4
# The orginal version is saved in .bash_profile.pysave
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:


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