Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

s1587

macrumors newbie
Original poster
Nov 16, 2007
14
0
Hi i am new to Mac so please help me out. I have to run a Linux shell using the terminal. My shell has been coded using C. I have gcc installed but bash refuses to recognize the command. I must run the program on the terminal only. Can someone please help me out here.
 

Eraserhead

macrumors G4
Nov 3, 2005
10,434
12,250
UK
So you load Terminal.app and type gcc and then it says 'command not found'?

If so you'll need to install the Developers Tools (Xcode) which is on the Mac OS X DVD or an up to date version can be downloaded from http://developer.apple.com/tools/download/ but you'll need a free developer account to do so.
 

rhoydotp

macrumors 6502
Sep 28, 2006
467
75
Hi i am new to Mac so please help me out. I have to run a Linux shell using the terminal. My shell has been coded using C. I have gcc installed but bash refuses to recognize the command. I must run the program on the terminal only. Can someone please help me out here.

screenshots please
 

pilotError

macrumors 68020
Apr 12, 2006
2,237
4
Long Island
So you wrote a program in "C"... did you compile it?

Sounds like you successfully started Terminal, if you have a .app,

./myApplication.app

should run it...

if you didn't compile yet,

gcc myApplication.c -o myApplication.app

then try and run it
 

Eraserhead

macrumors G4
Nov 3, 2005
10,434
12,250
UK
If you don't specify an output name its called a.out by default. So you use ./a.out to run it.
 

s1587

macrumors newbie
Original poster
Nov 16, 2007
14
0
i have installed xcode as well. once i type gcc prog.c i get a message "-bash: gcc: command not found".
 

s1587

macrumors newbie
Original poster
Nov 16, 2007
14
0
Is there any specific path where the gcc folder must be stored for bash to recognize it?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.