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

Mister V

macrumors newbie
Original poster
Jan 4, 2013
2
0
Hi guys,

the problem which I am struggling with is that I wanna compile an objectiveC code via terminal and it doesn't work.

I have the Xcode 3 version but OS X Mountain Lion.

After entering the command

gcc -framework Foundation -fobjc-gc-only -o Program sourcecode.m

terminal says: bash:command gcc not found
 

gnasher729

Suspended
Nov 25, 2005
17,980
5,565
Xcode 4.5 is a free download from the App Store.

Any particular reason why you are trying to use gcc and not clang?
 

LPZ

macrumors 65816
Jul 11, 2006
1,221
2
Hi guys,

the problem which I am struggling with is that I wanna compile an objectiveC code via terminal and it doesn't work.

I have the Xcode 3 version but OS X Mountain Lion.

After entering the command

gcc -framework Foundation -fobjc-gc-only -o Program sourcecode.m

terminal says: bash:command gcc not found

What about

Code:
/usr/bin/gcc -framework Foundation -fobjc-gc-only -o Program sourcecode.m
 

Mister V

macrumors newbie
Original poster
Jan 4, 2013
2
0
I've already tried clang... :/
reason: OS X Mountain Lion and old version of xcode?
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
9,544
6,042
Download Xcode 4 from the App Store (it's free), then open preferences -> downloads and download & install the command line tools.

IDK of any other ways to install the command line tools (not that I've tried.)
 

balamw

Moderator emeritus
Aug 16, 2005
19,366
979
New England
Silly me, I though that package required Xcode to be installed first. At least that's how I've used it.

B
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.