C Compiler

Discussion in 'Mac Programming' started by toddius, Nov 2, 2011.

  1. toddius macrumors newbie

    Nov 2, 2011
    Hi everyone,

    I am trying to learn some programming basics. I am watching the Harvard CS 50 course posted here and just started reading an Absolute Beginner's Guide to C by Greg Perry. Perry's chapter one directive is to get a C Compiler. So I guess I have a couple questions for the forum:

    (1) What compiler should I get that will work with a Mac? I noticed that X Code 4 is free if you have the developer membership (I don't - should I get one?). I also noticed that it would also be free if I had the Mac App Store (I don't). I have Mac OS X Version 10.5.8. If the advice is to pay for the developer membership - which one should I get? Will X Code 4 even work on my version of Mac OS X?


    (2) What else should I be doing in an effort to learn more about how to program?

    A logical follow up question might be - for what purpose do I want to learn how to program? I don't know. I just want to learn. I do not have a technical background (liberal arts to law school to unsatisfied lawyer) but I'm a good learner.

    Thanks in advance for the help/advice!

  2. jiminaus macrumors 65816


    Dec 16, 2010
    XCode 3 will be on the Mac OS X 10.5 DVD. XCode 4 requires a minimum of Mac OS X 10.6.
  3. BlkBear macrumors member

    Jul 13, 2004
    you don't need a paid developer membership to download XCode for free. You only need to pay if you want the ability to distribute through the app store. Create a free account and then download XCode. Once you install XCode you will have the gnu compiler toolchain and clang available from the command line. You can use gcc as you follow along your book and learn C. For the simple programs you'll run as you go through the book I would compile and run everything from the command line and not bother with the XCode IDE.
  4. toddius thread starter macrumors newbie

    Nov 2, 2011
    Thank you

    very much for the replies. I registered as a developer. My version of Mac OS X is just 10.5.8, though, and both X Code 3 and 4 apparently require 10.6.6 or higher. I guess I need to change my software? Or should I try to find X Code 2?

    Thanks again for the help. I really appreciate it.

  5. mobilehaathi macrumors G3


    Aug 19, 2008
    The Anthropocene
    If you have the DVD that presumably came with your machine, you can install the devtools from that.
  6. jiminaus macrumors 65816


    Dec 16, 2010
    Only XCode 3.2 required Snow Leopard. You need XCode 3.1.4.

    You can get XCode 3.1.4 by going into the Mac Dev Centre, then going into Additional Download, and then search for xcode 3.1
  7. gnasher729 macrumors P6


    Nov 25, 2005
    Look more careful on Apple's website for the _free_ ADC membership. And there are older versions of XCode on their website, which are again a bit harder to find, but they are there (Look for "Downloads"). I think XCode 3.1 is what you want.
  8. balamw Moderator


    Staff Member

    Aug 16, 2005
    New England
  9. JoeTyman macrumors newbie

    Nov 3, 2011
    For only 5 dollars you can get the newest XCode. If you are just trying it out, I would just install the newest free one. If you have Lion you can get it from the App Store. XCode is a great IDE, it much simpler than VS but still feels like a polished product.
  10. chown33 macrumors 604

    Aug 9, 2009
    Sailing beyond the sunset
    Not really. In posts #1 and #4 above, the OP said his version of Mac OS X is 10.5.8. That means no Mac App Store, and no Xcode 4 (the only version on the Mac App Store).
  11. robvas macrumors 68030

    Mar 29, 2009
    I would ditch the Greg Perry book and get something else. K&R or 'Practical C Programming' (O'reilly) for just plain C, or the new Big Nerd Ranch book on Objective-C (the first 1/3rd of the book is an intro to C)
  12. neowin macrumors newbie

    Jun 27, 2011
    Just to get you started , here is how you write a simple program once you have Xcode/g++/gcc installed.

    1. Go to terminal.
    2. Create a file 'hello.c' and copy paste the following code

    #include <stdio.h>
    int main()

    printf("Hello Macrumors\n");

    return 0;

    3. Then save the file.
    4. Type 'gcc hello.c' (w/o the quotes) to compile the program you wrote
    5. Then type './a.out' (w/o the quotes) to run the program :)

    Start writing small programs to learn faster.

Share This Page