Originally posted by hadocon:
I just installed netcat and I am a bit confused. I thought that I could invoke netcat regardless of what directory I was in by typing netcat or nc (just like I can with top, or whoami etc.). Instead I need to "cd" to the directory that netcat is stored and invoke it with "./nc". I have had this problem with other apps that I have installed like hugs98 (a haskell interpreter). I always had to do a dot-slash (./) before the application name for it to run. What am I doing wrong? how can I get these apps to run like a normal unix app (ie without the ./ prefix), regardless of the directory I am currently in...??!!
They ARE running like "normal Unix apps" (whatever that is). Your particular problem is that the new apps are not in your normal Unix path. Do this:
echo $PATH
On my system I get:
[cider:~] physicst% echo $PATH
/sw/bin:/sw/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin
...the system looks for an executable (or app), from left to right, in the listed folders. Your PATH may look different from mine. If the new apps are located, say, in /usr/local/bin (very very common)... then my system will not "see" them when I type their name at the command prompt. It will ONLY look in the folders listed in the PATH.
There are several ways around the problem but I will only list one of them because, in my opinion, it is the
correct way to do it.
One way to fix it is to extend your PATH so that the folder the new apps are in is included. The usual place for non-standard apps is /usr/local/bin and/or /usr/local/sbin. When I say non-standard I mean ones that are not installed as regular Mac OS X packages or come with the install from Apple. You can do this by editing the file /etc/csh.login It should look like this:
setenv PATH "/bin:/sbin:/usr/bin:/usr/sbin"
add (within the "") /usr/local/bin and /usr/local/sbin so that it looks like this:
setenv PATH "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
save it. Then type at the prompt:
source /etc/csh.login
echo $PATH
You should now see the full PATH including the entries you just made. Extending the PATH in the /etc/csh.login file will do it for all users by default on your system. It will also load up automatically each time you log in.
If the new apps you are adding are NOT in one of the "standard" folders... and not in any of the new folders you added to the PATH then either copy them to /usr/local/bin or make softlinks to them there.
If any of the above isn't clear please ask.