When you type a command line to the shell it takes the first word of the line as the name of a file and looks in several directories (folders) for a file of that name. To see all of the places that the shell will look for such files to obey type the command echo $PATH. If it finds such a file it obeys it as a program giving that program the whole command line. As Apple ships the Macintosh the shell looks only in places that are shared among the users of that machine. If you want to define a shell command accessible to just one user of the Mac, joe, then the corresponding file should conventionally go into the directory /Users/joe/bin. To tell the shell to look in an additional place for commands to obey, you must create a file in your main directory named “.profile”. (There may be such a file already.) In this file include the line:
export PATH=~/bin:$PATH
Subsequent new shell windows will look first in the directory ~/bin for files to obey when their name is given as the first word in a command line to the shell. Such files must be “executable” to be recognized and obeyed by the shell. To make the file xx executable type the command chmod 755 xx. Files produced by gcc are already executable.