$PATH is a variable in the Terminal that tell the computer which directories contain programs; that is, when you type a command such as
ls at the command-line,
ls is the name of a program in one of the locations specified by $PATH.
To figure out where a binary is, you can use the
which command. For example, typing
which ls should return something like
/bin/ls, which means that if you were to navigate to the /bin directory, you'd see the
ls program within.
To see the list of locations that are currently set for $PATH, you can type
echo $PATH at the command-line. It will return a list of directories (folders) separated by colons; these are the locations that will be checked in when you type a command name. In your case, you could copy those programs to a place like /usr/bin by typing the following command:
Code:
sudo cp [I]program_name[/I] /usr/bin/
You'll need to type in your administrator password for the command to work because /usr/bin is a system directory (you get permission to move files there with the sudo command). This will copy the program you choose to that folder, at which point you can simply type its name and press Return to run it.
—
Alternatively, if you don't want to mess with using the
sudo command (which you should
always be
extremely careful with), you can add a new directory to your $PATH, from which you'll be able to run commands in the future. To do this, you need to edit either .bashrc or .bash_profile. For example, type
Code:
open -a TextEdit ~/.bash_profile
This will open your Bash profile (think of it as command-line preferences) in TextEdit, where you can add this line to the bottom:
Code:
export PATH=$PATH:[I]/new/directory[/I]
where
/new/directory is the folder you want to add to your $PATH. For example, if you make a folder in your Home directory called
Programs, you could run the command
Code:
export PATH=$PATH:/Users/[I]your_username[/I]/Programs
and any binaries you put in that folder will run when you type their names at the command prompt.
Once you add that line to the file, save it and close it. For the change to take effect, type
This command tells the computer to look at .bash_profile and update any changes, which will in this case update your $PATH. To make sure it took effect, you can type
echo $PATH again, and you should see the same list you saw before with your new location at the end. Then, when you add any programs to the folder you chose (in this example, /Users/
your_username/Programs), you'll simply be able to type their name at the command prompt and press Return to run them.
—
There's one final thing worth saying. If you only want to run a program once, you can navigate to the directory containing it and type the command name preceded by a period and a slash (
./) to run the program regardless of whether the containing folder is in your $PATH or not. As an example, if your
cuffs program is in your Downloads folder, typing the following two commands would run it a single time:
Code:
cd ~/Downloads
./cufflinks
—
Hopefully that little overview will help you out.
If you want to find out more, search for "bash path" on a search engine and you should get relevant results.