View Full Version : Apple X11 - Command not found
maclaxguy
01-23-2003, 09:30 PM
This has probably been answered somewhere, I just couldn't find it. I have recently installed the Apple X11, and whenever I try to run a program from it, ie nmap, I get a "Command not found" error. What do I need to do to get this to work?
Thanks in advance.
Phil St. Romain
01-23-2003, 09:41 PM
Have you done a search to see where nmap actually go installed? Most likely in /sw/bin
Check it out and let us know. Also check out the FAQ on how to open programs.
If you have Fink installed, did you wrote:
source /sw/bin/init.csh
in your ~/.cshrc or ~/.tcshrc or ~/.login file
ericw13
01-24-2003, 08:09 AM
Just to restate the obvious: If you know you have installed a program, but you get "Command not found", you have one of two problems. 1) Typos. nmap != mnap :). 2 - and most likely) The program is in a directory that is not part of your path.
Check your path with
echo $PATH If the directory in which the program resides is not listed, you need to add it. There's lots of other threads about PATH around, so I won't repeat all the ways for the different shells.
Eric
Glanz
01-24-2003, 08:17 AM
Try "/sw/bin/nmap" as the command.
maclaxguy
01-24-2003, 07:56 PM
My nmap is installed in /usr/local/bin/nmap
maclaxguy
01-24-2003, 08:06 PM
Here's what I did. Maybe you guys can tell me if this sounds like the correct solution.
echo "setenv PATH ${PATH}:/usr/local/bin" >> ~/.tcshrc
If that works, perhaps you can tell me this: I've got an old path in my PATH, and I would like to take it out. How can I do this?
ie:
echo $PATH
/sw/bin:/sw/sbin:/Users/bfoster/bin/powerpc-apple-darwin:/Users/bfoster/bin ...
and I would like the /Users/bfoster/bin/powerpc-apple-darwin out.
Thanks.
ericw13
01-25-2003, 02:08 PM
You should pick a terminal-based text editor and learn a little about it. That's the easiest way to edit your configuration files. pico is probably the easiest to learn.
Just type
pico .tcshrc
Editing the file is as obvious as textedit. There are various commands shown at the bottom of the screen, such as quit, save, etc.
You just need 1 path statement in your .tcshrc. The easiest thing to do is find the original, add /usr/local/bin and remove anything you don't want/need.
HTH
Eric
maclaxguy,
As you have /sw/bin and /sw/sbin in your PATH already, you could save some trouble if you install nmap with Fink:
% fink list nmap
Information about 2120 packages read in 2 seconds.
i nmap 3.00-3 Network exploration utility (X11 support)
nmap-nox 3.00-2 Network exploration utility
maclaxguy
01-25-2003, 03:11 PM
Originally posted by ericw13
You just need 1 path statement in your .tcshrc. The easiest thing to do is find the original, add /usr/local/bin and remove anything you don't want/need.
Let me make sure I understand what you mean:
redefine the PATH in my .tcshrc file?
ie, add a line that says
setenv PATH /usr/bin.... etc
(there is currently no "setenv PATH" in the .tcshrc file)
However, will this not keep the original PATH for all users? I'd like to edit that, and actually take part of it out.
BTW, I'm versed in how to use pico, so that should no be a problem for me.
ericw13
01-27-2003, 08:03 AM
You don't have to redefine it unless you want to take something out of the default PATH.
bash$ export PATH=$PATH:/my/new/dir:/another/new/dir
tcsh% setenv PATH "$PATH:/my/new/dir:/another/new/dir"
will append /my/new/dir and /another/new/dir to your path. You could also prepend directories to your path by switching the order around.
Rather than trying to remove directories from your path, you should probably put your directories first, as the shell checks PATH entries sequentially looking for the executable you want to run.
For instance, suppose you have an executable called foo. foo is typically installed in /usr/bin. If you have your own program called foo in /Users/yourname/tools, you could do the following to force your program:
tcsh% setenv PATH "/Users/yourname/tools:$PATH"
However, will this not keep the original PATH for all users? I'd like to edit that, and actually take part of it out.
I'm not sure if you mean that you want to redefine the PATH for everyone, or just yourself. ~/.tcshrc will only affect your account. To change these definintions for everyone, look at /etc/csh.login. Mine (which should be the default, as I don't use csh) includes
setenv PATH "/bin:/sbin:/usr/bin:/usr/sbin"
You should be able to modify this statement to change the base PATH for everyone (subject to their own .cshrc modifications).
HTH
E
PS For the unfamiliar, I'm using bash$ and tcsh% as notifiers as to which syntax is being used, as they are not interchangable.
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.