Slightly off Blackberry topic but recently I performed a clean install of Snow Leopard on my Mac Mini and the other day found myself needing to modify the $PATH variable to reconfigure some of my favorite commands via Terminal. The last time I'd done this was many years ago but I finally got the syntax down correctly and thought it could help some of you out there including those on Leopard and even Tiger - if you're using the Bash shell.
What we need to do since it's a fresh Snow Leopard install is create a .bash_profile file in our home directory with the additional paths we'd like to add. If you're not working with a new install you can check if there's a .bash_profile file that already exists by navigating to your home directory and using the 'ls -a' command to display hidden files. If one already exists you would edit this file with the directory paths you would like to add to the environment. Just add additional 'PATH=/path/you/want/to/add/:' statements after the export statement but before the final ':$PATH'.
An alternative to the .bash_profile is to edit the file 'paths' in the /etc directory with the directory paths you'd like to add however this seems less intuitive to me, especially if you have multiple users on your system and don't want them to have access to particular commands from Terminal.
In my case, the .bash_profile file didn't exist in my home directory in Snow Leopard since I'd performed a clean install so opened a new Terminal session(opens in your home directory) and ran the following command:
echo 'export PATH=/path/you/want/to/add/to/env:$PATH' >> ~/.bash_profile
Running this command creates the file '.bash_profile' and adds your new path along with the current directory paths that reside in the $PATH variable. For example, if I wanted to include subversion commands like svn, svnadmin, svndumpfilter, etc. located (in my case) in the /opt/subversion/bin directory, I'd simply issue the following command:
echo 'export PATH=/opt/subversion/bin/:$PATH' >> ~/.bash_profile
You can test if this works by opening up a new terminal window, typing the 'env' command and looking for the newly added directory values in the output.