The following was performed with 'Tiger', MacOS X 10.4.0, running.
For those using 'Terminal':
To add a directory path, or directory paths, to PATH (and thus creating '~/.bash_profile'):
01. Launch 'Terminal'.
02. Enter ...
echo 'export PATH=xyz:$PATH' >> ~/.bash_profile
(and press the <return> key) ... where 'xyz' is your desired path(s).
03. Open another 'Terminal' window.
04. Enter ...
env
<return> ... and note that 'PATH' now includes 'xyz'.
-----
To remove the '.bash_profile' file (thus, returning PATH to its default value):
01. Launch 'Terminal'.
02. Enter ...
cd ~/; ls -la; rm -rf .bash_profile; ls -la
<return> ... and note the '.bash_profile' file, in the first 'ls -la' no longer exists in the second 'ls -la'.
03. Open another 'Terminal' window.
04. Enter ...
env
<return> ... and note that 'PATH' has returned to its initial paths.
---- ----- ----- ----- ----- -----
For those using 'X11':
01. Enter ...
cd /etc; sudo cp bashrc bashrc_; open /etc
02. Drag 'bashrc' to the 'Desktop', and double click on (the 'Desktop' copy of) 'bashrc'.
03. Enter (at the end of the file, on a new line) ...
export path=xyz:$PATH
[
03 October 2005, 23.17
Correction:
As per lurk's observation:
path and PATH are two different variables. PATH as a env varialble, and path as a user defined variable. Thus, ...
export path=xyz:$PATH
... is incorrect. In 'X11' the correct 'bashrc' line would be ...
PATH=$PATH:xyz
Thanks lurk
]
... where 'xyz' is your desired path(s).
04. Close and save the file.
05. Click on (the 'Desktop' copy of) 'bashrc' and select the 'Finder' 'File, Get Info' menu item.
06. Naviagate down to hte 'Ownership & Permissions:' section, clicking on the disclosure triangle.
07. Click on the pad lock, change 'Owner:' to 'system' - do not worry if it snaps back to the current user, and change 'Group:' to 'wheel'.
08. Drag the 'Desktop' based 'bashrc' file onto the 'etc' window - clicking on 'Authenticate', 'Replace', and (entering any needed info, and then) 'OK' of the three windows that follow.
09. Open another 'X11' window.
10. Enter ...
env
<return> ... and note that 'PATH' now includes 'xyz'.
-----
Hey, what about that 'bashrc_' file in '/etc'?.
It is a backup of your original 'bashrc' file. Should you want to restore your PATH settings - all you need to do is enter
cd /etc; sudo mv bashrc_ bashrc
<return>.