Configuring the PATH System Variable
Contributors:
santaimpersonator
Mac OSX and Linux Based Systems
On Mac OSX and linux based systems, users can display the paths for the $PATH
system variable by entering echo $PATH
into the terminal.
Note: The commands below use the GNU nano text editor. Feel free to use another text editor of your choice (such as
vi
for Vim).To modify the variable:
- Open up Terminal and run the following command to edit the paths file:
sudo nano <file path location>
- There are several locations where users might be able to modify the
$PATH
system variable:/etc/paths
(Mac OSX - Mountain Lion)/usr/bin
/usr/local/bin
/usr/local/sbin
/usr/sbin
~/.bash_profile
~/.bashrc
~/.profile
- There are several locations where users might be able to modify the
- Enter the super user (administrative) password, if prompted.
- Enter the modifications for the path you wish to add.
- The entry field is usually near the bottom of the file.
- Hit Ctrl+X to quit.
- At the input prompt, send Y and hit Enter or Return to save the modified buffer.
Displaying paths of
$PATH
variable and accessing the ~/.profile
file for modifications. (Click to enlarge) That’s it! To verify the changes, in a terminal window, type: echo $PATH
Note: Another common method is to use the export
command in the terminal.
Example: export PATH=$PATH:<file path to be added>