PDA

View Full Version : Terminal: how to add a location to $PATH




hinkenput
Feb 15, 2012, 01:19 AM
I need a simple line of code to tell Terminal to look for my scripts in Applications/Scripts, where I put them. In other words, when I enter "echo $PATH" I want to add ":/Applications/Scripts" to the string that is returned. I am not a programmer, and my son wrote this command for me a couple of years ago, and it worked, but I didn't save it. I've tried searching the web, but haven't been able to find it. Can anyone write it for me? Thanks.



jahala
Feb 15, 2012, 02:01 AM
Look at this article. Even though it says it is for linux, the terminal in OS X runs bash just like the default terminal in most versions of linux these days.
http://www.troubleshooters.com/linux/prepostpath.htm

antonis
Feb 15, 2012, 05:13 AM
export PATH=$PATH:/Applications/Scripts

willieva
Feb 15, 2012, 06:55 AM
Put
export PATH=$PATH:/Applications/Scripts
in ~/.bash_profile

This is assuming you're using bash as your shell, which you probably are. If you're using csh or tcsh, you need to put
setenv $PATH:/Applications/Scripts
in ~/.cshrc

odinsride
Feb 15, 2012, 11:39 AM
Put
export PATH=$PATH:/Applications/Scripts
in ~/.bash_profile

This is assuming you're using bash as your shell, which you probably are. If you're using csh or tcsh, you need to put
setenv $PATH:/Applications/Scripts
in ~/.cshrc

Also don't forget to reload your .bash_profile by typing ". ~/.bash_profile" (otherwise changes won't take effect until next login)