Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Now what | 29 comments | Create New Account
Click here to return to the 'Now what' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Now what
Authored by: jschank on Oct 17, '02 04:37:41PM

Hi there,
I don't want to sound too ignorant, but this is my first attempt at building a project on my Mac.
The instructions seemed to work fine, but I cannot seem to run the program. It says nano: Command not found. when I try to run it.
Could this be because for sudo I used an admin password instead of the root password?
Thanks,
John Schank



[ Reply to This | # ]
Now what
Authored by: macmike42 on Oct 17, '02 05:21:13PM

tcsh (the default Mac OS X shell) doesn't actually hunt for the command you've typed, but rather consults a cache of available commands. If you are still in the same shell you are in after installing a new program, type "rehash" to force tcsh to rebuild the cache. The alternative is to open a new shell/terminal window.



[ Reply to This | # ]
Now what
Authored by: Glanz on Oct 17, '02 05:27:50PM

I had to place an alias in my ".tcshrc" file in the home directory, and I had to write out the full path, as is done in BSD & Linux:
"alias nano /usr/local/bin/nano"
That will make it run... or you can type the path to it in a terminal window "/usr/local/bin/nano" or you can make a symlink



[ Reply to This | # ]
Now what
Authored by: mervTormel on Oct 17, '02 05:27:59PM

i suspect that /usr/local/bin is not in your path.



[ Reply to This | # ]
Now what
Authored by: jschank on Oct 17, '02 05:47:31PM

Hi again,

Thanks for the replies. But still no luck.
I didn't have a .tcshrc file in my home directory, so I created one with the alias command mentioned... No change.
I tried actually changing my CWD to /usr/local/bin typing nano<enter> still said command not found.
I did an ls, and the file is there.
I checked my path via echo $path, and as mentioned /usr/local/bin is not in the path. So, New question, How do I edit my path???
Thanks,
John



[ Reply to This | # ]
Now what
Authored by: babbage on Oct 17, '02 10:53:51PM

If the current working directory isn't in your path, then changing to /usr/local/bin wouldn't be enough either. The usual solutions are [a] add "." to your PATH environment variable (this is generally frowned on for security reasons, but is awfully convenient and I don't blame people for liking the setting), [b] prefix these commands with a dot-slash "./", which effectively fills in the full path for the shell (relatively simple, and not a security issue like the first option), or [c] run the command with the full path -- /usr/local/bin/nano.

Like others have said, you need to reload your command cache with "rehash", and make sure that /usr/local/bin is in your path with "printenv PATH". As a last ditch test you can try launching /usr/local/bin/nano directly, which should work regardless of your PATH or command cache, but really those need to be fixed. The alias will also work, but it's a "papering over the cracks" solution that treats the symptom, not the disease. In the long run it's better to just fix your PATH rather than add aliases for every single command...



[ Reply to This | # ]
Thank You very much!
Authored by: Glanz on Oct 20, '02 09:51:06AM

Well, after all my trouble, I switched to the zsh shell via the chsh command and corrected my paths there so that all worked well, then I did the same with bash. I came back to tcsh to do the same and all worked well, but in tcsh I had to use the "./", unlike the other shells. Thank you again! I really appreciated your little reminder! Zsh and Bash are the shells with which I am most comfortable, but tcsh has its advantages too, since it is the default shell for OS X.



[ Reply to This | # ]
Now what - Update
Authored by: jschank on Oct 17, '02 05:53:09PM

Apparently, I spoke too soon. A new shell, and (I guess) the alias seems to work.
Thanks, For the help!
BTW, How do I edit my path?



[ Reply to This | # ]
Now what - Update
Authored by: matt_j_gray on Oct 17, '02 07:02:24PM

To edit your path (and other things), you can start by reading

/usr/share/tcsh/examples/README

and looking at the files in that directory.

To add something to your path in tcsh, try

setenv PATH new/thing/to/add:$PATH

This will add the new directory to the front of your PATH, keeping the old stuff as well.



[ Reply to This | # ]