Programming in OSX.

Discussion in 'Mac Programming' started by linuxftw, Jun 25, 2007.

  1. linuxftw macrumors newbie

    Jun 25, 2007
    I have recently been considering switching to Mac. I have done a lot of C, C++ and java, compiling on linux/windows. Could somebody explain to me briefly which compilers, libraries, programming tools etc you use on OSX.
  2. yellow Moderator emeritus


    Oct 21, 2003
    Portland, OR

    Same compilers you're used to using, Gnu compilers.

    Libraries and Tools are free from Apple.

    Go to the above site, sign up (free), and downloaded the latest version of XCode.

    Consider getting a book on Objective-C and Cocoa programming.
  3. ChrisA macrumors G4

    Jan 5, 2006
    Redondo Beach, California
    First off, anything that would work under Linux should work under Mac OS X. After all Mac OSX just UNIX with a graphical desktop running. But the Mac does add a development system cal Xcode that offers drage and drop user interface development and other graphical tool. But under it all Xcode uses the GNU tool set same as Linuix.

    If you want to build Mac applications Xcode is a self-contained system and you don't have to know it is using gcc.
  4. MacRohde macrumors regular


    Jun 1, 2004
    Copenhagen, Denmark
    Good evening.

    I'm a Windows programmer at day but at night I shed my hide and program on the Mac, and here's what I have to say on the subject:

    Regarding C/C++ there's the GNU compiler set just as on Linux (they are also available on Windows as Mingw as you probably know). So, for C and C++ you're all set.

    For GUI development using C++ you can use Qt, and for GUI development using C you can use Carbon which is an Apple provided API. Carbon is mainly a transitional API though - it was developed for developers who needed to get their Mac OS applications to run on Mac OS X back when Apple made the Mac OS -> OS X transition and such applications were said to be "Carbonized" - but it's a fully functional API.

    Many of the lower APIs on Mac OS X is also C APIs, and since Mac OS X is Unix underneath there's also access to all the different Unix/Linux frameworks. You can even get X Windows on OS X!

    Regarding Java, Apple and not Sun supplies the runtime and the SDK. The Apple Java version is always a little late compared to both Windows and Linux, and Apple has the nasty habit of making you upgrade if you want the latest Java version! As of now there's Java version 5 for Tiger, but AFAIK Java version 6 is slated to be a Leopard only thing! Other than that Java works fine on Mac OS X and obviously all the Java IDEs like Eclipse and Netbeans can run on the Mac.

    If you really want to do native applications development on the Mac you should look into Objective-C and Cocoa. Objective-C is C with objects just like C++ but much much closer to C than C++. If you know some basic C and some OOP principles you can learn Objective-C in a few hours. It's a very powerful language (you can find a small booklet on ADC describing the language - it's quite good). Cocoa is the Objective-C API used for writing native desktop applications on the Mac. It's a very nice API to work with and utilizes some principles which are very foreign for a native Windows developer.

    You would use Xcode and Interface Builder for Objective-C/Cocoa development and Xcode for other C++/C development (Xcode uses the GNU tool set). Both programs are free from Apple and come on you install CD/DVD; they can also be downloaded for free from ADC. Save for Java you would basically use Xcode for most development on the Mac.

    Other than that all the usual scripting languages also work on the Mac (Python, Ruby, Perl etc.).
  5. linuxftw thread starter macrumors newbie

    Jun 25, 2007
    Thanks for the replies!

    Do any of you know if there is a version of GCC available for OSX? Because personally I don't like MinGW :p

    Another quick question, are there any assemblers that work on OSX?
  6. MacRohde macrumors regular


    Jun 1, 2004
    Copenhagen, Denmark
    uhm, MingW is for Windows only, hence the name Minimalist GNU for Windows.

    GCC is installed with Xcode.
  7. plinden macrumors 68040


    Apr 8, 2004
  8. Cromulent macrumors 603


    Oct 2, 2006
    The Land of Hope and Glory
    As has already been stated Xcode uses GCC. I have not looked in depth but I assume it also comes with the GNU assemblers as well.

    Edit : In fact it would have to. So yes, just install Xcode.
  9. MagicUK macrumors regular


    May 12, 2007
    Hampshire, England
    Thanks, very useful post.

Share This Page