In PATH but compiled prog not running

Everything else.

In PATH but compiled prog not running

Postby dingus » Fri Dec 28, 2001 5:56 am

Hi
I'm new to Darwin and compiling. To learn a bit I'm reading a C in 21 Days book. I wrote out the source and got it to compile without an error. When the program is in the /usr/local/bin directory, it runs without a hitch. But when I put it in the ~/bin directory (my home base), I get a "command not found" error. I checked the PATH variable, and ~/bin is among the directories listed, so I'd think when I type in the program name (multiply, in this case) it would run. Since it won't I'm puzzled. I did have to create a ~/bin directory (it's apparently not part of 10.1), which is visible in the Finder, but I set the permissions to allow for execution. I suspect what I'm overlooking is supersimple. Can anyone tell me what to do to get the program to run in ~/bin?
Jon
dingus
 
Posts: 1
Joined: Thu Dec 27, 2001 8:00 pm

Re: In PATH but compiled prog not running

Postby apex » Sat Dec 29, 2001 1:27 am

Why are you trying to run it from ~/bin/? that is a very very odd place to run a binary from. /usr/local/bin/ or /usr/bin/ is the place you should be running it from.
apex
 
Posts: 355
Joined: Sun Aug 05, 2001 7:00 pm

Re: In PATH but compiled prog not running

Postby forty_two » Tue Jan 01, 2002 8:40 am

Originally posted by dingus:
Hi
Can anyone tell me what to do to get the program to run in ~/bin?
Jon


You have to add ~/bin to your search path for binaries. Be advised, though, that this is a nonstandard place for binaries. As apex mentioned you might be better off putting it somewhere that's already in the search path.

Hope that helps.
forty_two
 
Posts: 7
Joined: Sun Dec 09, 2001 8:00 pm

Re: In PATH but compiled prog not running

Postby orange1 » Wed Jan 02, 2002 2:08 pm

echo $PATH
if ~/bin is indeed there, then move your binary there. then open a new terminal window and give it a try. usually when i install something new, it won't find my new binary until i get in a new terminal.
--
-willy
Freedom will henceforth be compulsory. -Random Party Manifesto
orange1
 
Posts: 92
Joined: Tue Aug 21, 2001 7:00 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 11 guests

cron