Mac OS X Install GCC Compiler

Posted October 3, 2004 by macster in Mac system administration

Compiling open source projects typically requires a C compiler and GCC is typically the compiler of choice. Mac OS X does not install the GCC compiler by default, but it is freely available in the xcode suite of development tools.

To install the GCC compiler, download the xcode package from You will need to register for an Apple Developer Connection account. Once you have registered, login and click Download Software and then Developer Tools. Find the Download link next to Xcode Tools (version) – CD Image, and click it.

Find the downloaded package, double click it, and follow the installation instructions to install GCC and a host of other development applications. The GCC compiler will be located at /usr/bin/gcc.

Websites tend to change over time, so if you notice that the steps to download xcode have changed, please post a comment. I will update the tech-recipe. For example, Steve posted (and Jim Daniel confirmed) that you can download the GCC for 10.6 and 10.7 directly from kennethreitz on github. See comments for the latest link.

The Conversation

Follow the reactions below and share your own thoughts.

  • bogus dude

    What if I’m still running Tiger, but the only download I see is for Leopard? The PDF says that the version listed is for Leopard only.

    • Keep looking down the list.. you’ll need a version 2.x of the developer tools. Like this:

      Xcode 2.5 Developer Tools
      Xcode 2.5 is an update release of Xcode developer tools, providing bug fixes over Xcode 2.4.1. Xcode 2.5 can be installed on Tiger (Mac OS X 10.4) or on Leopard (Mac OS X 10.5).

      • Mem4sports

        Quinn can you convert on a mac a doc that looks like a page which should really be a zip file?

        • Honesty

          Q: The first time I build my program with Code::Blocks I get the following error message: “…uses an invalid compiler. Probably the toolchain path within the compiler options is not setup correctly?! Skipping… Nothing to be done” What’s wrong?

    • math

      Keep searching, IT IS there. I went into the same issue, the default xcode that appear in the page is 3.x, but you need 2.5, it’s the latest for Tiger.
      I searched in the site in the developer tools section, yeah I know it’s annoying.

  • P

    Apple sucks 1GB download for GCC

    • Q


      • leo

        Thank you very much for your advice.

    • thatguy

      GCC-4.0 requires 95mb when installed from your OS X DVD.

  • thanks for sharing the web addresses. this will help a lot.

  • Mahesh Gupta

    thank u very much…….

  • Mahesh Gupta

    May be better download iphone SDk 2.2 which has Xcode in it. size is 1.56GB.:-)

  • Rich Feit

    Thanks much! Minor change — you first click on “Mac OSX”, then there’s XCode Tools in the resulting list.

  • Anonymous Coward

    srsly? 1+GB for freaking gcc? that is RIDIC!

  • Ali

    Thanks for the instructions. The path has changed slightly.
    Once you log in, go to: Downloads -> Developer Tools -> Xcode 3.1.2 Developer Tools and download the package called Xcode 3.1.2 Developer Tools DVD (Disk Image)


  • The ‘gcc compiler’ is installed when one installs ‘XcodeTools’ (via the ‘XcodeTools.mpkg’ file) from the installation CD (if installing Panther [MacOS X 10.3.x] or earlier) / DVD – in the ‘/Xcode Tools/’ folder.

    Or, in the CDs’ / DVDs’ ‘/Xcode Tools/Packages/’ folder is / are the ‘gccx.x.pkg’ (where s.x is the version number) installer file(s).

  • I like the Apple sucks for 1GB download for GCC. It is really good. Try!

  • thatguy

    GCC-4.0 requires 95mb when installed from your OS X DVD.

  • Witek

    Some Apple forum members managed to figure out that the most up to date and final release of Xcode for Tiger is v 2.5. You can find the link to the Xcode package at

  • J.C.

    Sorry if i am repeating anyone but I know if you have mac 10.4.X then on the install disk you can find a copy of xcode…

  • J.C.

    Opps I didn’t see lift chair…
    “The ‘gcc compiler’ is installed when one installs ‘XcodeTools’ (via the ‘XcodeTools.mpkg’ file) from the installation CD (if installing Panther [MacOS X 10.3.x] or earlier) / DVD – in the ‘/Xcode Tools/’ folder.

    Or, in the CDs’ / DVDs’ ‘/Xcode Tools/Packages/’ folder is / are the ‘gccx.x.pkg’ (where s.x is the version number) installer file(s).”

  • R

    I’ve been installed the powerpc-apple-darwin9-gcc-4.0.1. I’m now concerned with an error message from typing ‘gcc -Version’ into console:

    ”powerpc-apple-darwin9-gcc-4.0.1: couldn’t run ‘/usr/bin/powerpc-apple-darwin9-gcc-ersion’: No such file or directory”

    This seems to be obvious, because the letter ‘v’ from version is missing. But where have I look at to correct this mistake ?

  • kingman

    The GNU Compiler for Java (GCJ or gcj), a free software compiler for the Java programming language, forms part of the GNU Compiler Collection…. The GNU Compiler Collection is a full-featured ANSI C compiler..
    lift chair recliners

  • Anonymous

    This article provides an overview of the GNU Compiler Collection (GCC) from the Free Software Foundation and its use on Mac OS X… very useful blog and i love this article a lot..
    lift chairs

  • José Borges

    I have an Mac with OS a version 10.5.8. I recently installed Xcode v3.1.3 and I started to get errors and warnings in compiling programs with gcc, such as:
    ” ….. incompatible implicit declaration of built-in function ‘ceil’ ”
    Can someone help me?

  • Anonymous

    thank you for writing this helpful notes.
    Can you tell me how to install CGAL in MAC

  • Kurt Bigler

    As a long-time XCode user it has been installed on my Mac for years, and I have applied updates occasionally. Nonetheless gcc is not located at /usr/bin/gcc (which has not been an issue until now since I don’t normally use the command line for compiling). It is however, located at /Developer/usr/bin/gcc. So I added /Developer/usr/bin/gcc to my path, hoping that would let me use gcc and make to build libjpeg under Leopard. (Aside: Apple’s own jpeg support via “Image IO” appears to ignore the specified “quality” for jpeg compression).

    However the ./configure script for libjpeg says:

    configure: error: installation or configuration problem: C compiler cannot create executables.

    But at least now that I altered my $PATH it recognizes that gcc is present.

    I have not tried to debug the configure script, but figure I am missing something basic, or else XCode installation practices have changed. My XCode is 3.1.1, and gcc from the command line says “i686-apple-darwin9-gcc-4.0.1”.

    • Kurt Bigler

      FIXED: I installed XCode 3.1.4 and it resolved the problem. It also installed gcc in /usr/bin so I no longer have to alter my $PATH.

  • Areej

    do you know how to install ns-2.34 on mac os 10.5.5
    I all ready have XCODE 3.1.1
    thnx ,

  • This article provides an overview of the GNU Compiler Collection (GCC) from the Free Software Foundation and its use on Mac OS X… very useful!

  • Anonymous

    well done.
    For more jobs visit



  • Anonymous

    As of April 4th 2010:
    Once logged into, click Developer Tools, then click Xcode 3.2.1 Developer DVD (Disk Image)

  • isak

    same address – but the topic is called “Xcode 3.2.2 Developer Tools” and it is called Disc Image, not CD Image.

  • Anonymous

    someone have recompiled for Mac OS X Leopard?

  • of mesothelioma

    I have an important question. You mentioned that you chose to ignore ring settings in this paper enigma machine. I have been trying to get the ring settings working by cutting each paper strip in half and shifting the right side by the appropriate ring to the 2nd position if the ring is B offset. If all the examples have a GAAA and RAAA setting, I get the paper enigma to match the enigma simulators, but if I try any ring offset, the results don’t match. I went to the rotor details in Wikipedia and tried to replicate their results with GAAA and RBBB to get EWTYX to no avail. Could you please help tell me how you would get this to work right if I cut your strips in half and rotate 6 different rings instead of 3?

  • Sprintox

    This is retarded. 1 GB for a gcc compiler?

    • sam

      It’s not just a gcc compiler, it’s a whole development package including many other applications.

  • cari

    Is there any way to download a mac compiler with having an account with Apple? Because it is $100 a year. I just dropped my account because I felt like that was way too much money to spend every year for what Apple offers you. Plus If I get an account and download the compiler, if I don’t renew my account I think the compiler will stop working just like my email stopped working.

    • Morphenius

      Apparently it’s possible to become a developer without signing up for any of their programs. Becoming a developer is free, and at that point you can download Xcode.

  • Asdf

    I hate this because I dont want to install xcode. I just want gcc. Xcode is a >2gigs .dmg (with the ios sdk) when gcc is much smaller. It’s pretty ridiculous when you have to install unnecessary and unwanted things to get a basic staple of computer programming.
    This is why apple is awful. I do not want your IDE, I most certainly do not want the bundled iphone SDK (and I cannot find a non-bundled version from apple’s dev. site). I just want gcc (which should come with osx by default).
    Sorry but osx is for children with over-protective children.

    • Asdf


      *sorry, but osx is for children with over-protective parents

      • Jnkm 89

        you can get gcc from their website ( ) and install it yourself. downloading xcode is just one way to get it installed on your computer. Learn how to use the web before make these ignorant/moronic comments.

        • Stuck

          how do you install it on mac from the website?

  • George Jost

    I just installed it. I’m frustrated. I installed the package, it told me location is “Mac Harddisk”. That doesn’t give me a path. In theory, it should be in /usr/bin?

    Nothing is there. It claimed to copy over 93 MB but didn’t do anything? How can I tell if this was actually installed?

  • keshav

    i just installed xcode from the above url. The install was successful but I can’t find gcc binary. Is it under a different name? I’m running OSX 10.5.8

  • Toltmanns

    It looks like apple is forcing us to pay $100 to get this xcode software, is there another way?

    • Rebegol

      I had a lot of trouble with this today — only since xcode 4 came out is xcode 3.0 no longer available (it was free). You can pay about $5 for Xcode 4. However, your installation disk will have the right version of xcode for your operating system on it (for free). I upgraded to Snow Leopard and on the install disk, Xcode is an optional feature that does not install unless you ask it to.So look to the disk rather than the internet — I couldn’t find xcode free anywhere.

  • Allen Liu

    I had the same issue of installing xcode but still could not find GCC. Try searching for “install xcode” through Spotlight and run that first file. That should do it. Took me a while to figure it out. Hope this helps!

  • tokeiten


    it works beautifully !

  • tokeiten

    if what you want, is not the Xcode IDE but just the plain compiler type:

    gcc filen_name -o output_file_name

    or try:

    man gcc

    good luck!

  • Kebman

    Does not work. You have to pay to download Xcode. I still need GCC, tho.

  • Kebman

    My bad, seems to work now. :p Had some problems downloading Xcode for older OS X’es.

  • Alex

    Thank you very much, this is exactly the info i needed.

  • Steve

    Has links to just download GCC for 10.6 and 10.7

    • greyfaerie4

      Thank you!>

    • Mike

      The version from github saved me a lot of time… just neededd gcc and I did not want the system upgrade. Thanks guys!

  • Jim Daniel

    Dude, move the last comment to the top (sticky it)! This is exactly what I needed and it works perfectly!

  • foo

    Apple sucks big time!

    • greyfaerie4


  • Sculptor

    I don’t want to pay Apple a nickel for gcc! That would be subverting to whole purpose of gcc. How do a get a free download?

    • MacManux

      ??? XCode is a free download

      • Kevin Grittner

        It seems to be insisting on a credit card number, security code and all, to let me do the free download. I’m not going to put a credit card number into App Store. Period. Ever. Is there any other way to get gcc for OS X? If not, I guess I’ll just support Linux, Windows, HP/UX, AIX, etc., and forget OS X.

  • kim

    I have downloaded gcc compiler.. how do I go about using the c++ programming?

  • Ted Yu

    I am using OSX 10.7.5
    I downloaded xcode312_2621_developerdvd.dmg and from there I installed gcc4.0.pkg
    But I still cannot find where gcc was installed.

    Did I install the correct package ?

  • Rishabh


    I have XCode downloaded for a while, yet I do not have access to GCC. Help?

    • Daniel B

      The procedure has changed slightly, as the package name is different now. Note to everyone: Xcode is *free* now. As in, no need to pony up $$$. Didn’t get asked for CC info either (though I do have an iTunes acct and probably that’s why).

      Get it from the App Store (as I said, free) and after downloading/installing, you need to go to Xcode -> Developer Tools -> More Developer Tools

      The package name is now called Command Line Tools (OS X version name) for Xcode – (release date)
      The site might ask you to register as a developer before showing up the list.

  • Nate

    I think the website changed

  • Howard

    Xcode 4.3 changes all this. Searched the Documentation, and it says:
    “The command-line tools are not bundled with Xcode 4.3 by default. Instead, they can be installed optionally using the Components tab of the Downloads preferences panel …”

    Also, since I saw the reference to /Developer in another comment, I should point out it goes on to say:
    “/Developer No Longer Exists
    The simplification afforded by repackaging Xcode 4.3 as a single app bundle eliminates the need for the /Developer directory containing prior versions of Xcode….”

  • drew

    Going from Linux to OSX is painful. Takes two seconds to install GCC in any Linux Flavor.

  • LJ

    this is the website for the open source compiler, small download, heaps of instruction, and best of all: it works! LOL
    xcode may be good for learning, with all the pretty colours, but it ends up being distracting, thus slows down the coding process – at least for me anyhow.
    xcode can easily be replaced by a terminal window and text editor.
    much simpler, just a little discipline with regard to learning syntax and developing your own individual coding style.

    hope the website helps 🙂

  • Geeticka

    You could go to the terminal, type GCC and your mac will tell you that you do not have gcc but will ask you if you want to download the xcode