MacOS – remove an entry in the $PATH

androidmacospathterminal

I'm running OS 10.8. When I

echo $PATH

my terminal outputs

/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/usr/texbin:/Users/austinzuffi/Development/Android/adt-bundle-max-x86_64/sdk/tools

and i want to remove or at least edit

/Users/austinzuffi/Development/Android/adt-bundle-max-x86_64/sdk/tools

I can't find out where that string is entered. My /etc/paths shows

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

I'm assuming there's a file such as .bashrc that adds the entry upon login. I just can't find out which file is doing it. If you know which files might append my path environment variable, please let me know so I can check!

Also, if eclipse is modifying the system variable, let me know. I'm assuming eclipse doesn't have that power however I'm new to it.

Thanks guys
-Austin

Best Answer

Look in ~/.profile, ~/.bashrc, ~/.bash_profile, /etc/bashrc for a line of the following form:

export PATH=$PATH:/Users/austinzuffi/Development/Android/adt-bundle-max-x86_64/sdk/tools

Also look to see if any of those files contain a line starting with either source or . (which is short for source). If they do then look in the sourced files too.

A quicker way might be to use grep. Open a terminal and, from your home directory run

grep -r "/Users/austinzuffi/Development/Android/adt-bundle-max-x86_64/sdk/tools" .