gcc doesn't work

Discussion in 'Mac Programming' started by Mister V, Jan 4, 2013.

  1. macrumors newbie

    Joined:
    Jan 4, 2013
    #1
    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
     
  2. macrumors G5

    gnasher729

    Joined:
    Nov 25, 2005
    #2
    Xcode 4.5 is a free download from the App Store.

    Any particular reason why you are trying to use gcc and not clang?
     
  3. LPZ
    macrumors 65816

    Joined:
    Jul 11, 2006
    #3
    What about

    Code:
    /usr/bin/gcc -framework Foundation -fobjc-gc-only -o Program sourcecode.m 
     
  4. thread starter macrumors newbie

    Joined:
    Jan 4, 2013
    #4
    I've already tried clang... :/
    reason: OS X Mountain Lion and old version of xcode?
     
  5. macrumors 603

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #5
    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.)
     
  6. macrumors 68000

    Joined:
    Mar 29, 2009
    Location:
    USA
    #6
    They now have a download that's only 171MB instead of almost 2GB for all of XCode. It just includes the command-line tools.

    http://kennethreitz.com/xcode-gcc-and-homebrew.html
     
  7. Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #7
    Silly me, I though that package required Xcode to be installed first. At least that's how I've used it.

    B
     

Share This Page