Mac OS X install gcc compiler
Compiling open source projects typically requires a C compiler and gcc is typically the compiler of choice. Mac OS X doesn’t 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 http://connect.apple.com/. You’ll need to register for an Apple Developer Connection account. Once you’ve 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, doubleclick it and follow the installation instructions to install gcc and a host of other development applications. gcc 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 and I’ll update the recipe.







bogus dude said on October 10, 2008
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.
Quinn McHenry said on October 10, 2008
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).
math said on October 14, 2008
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 said on November 21, 2008
Apple sucks 1GB download for GCC
buy youtube views said on January 8, 2009
thanks for sharing the web addresses. this will help a lot.
Mahesh Gupta said on January 14, 2009
thank u very much…….
Mahesh Gupta said on January 14, 2009
May be better download iphone SDk 2.2 which has Xcode in it. size is 1.56GB.:-)
Rich Feit said on March 1, 2009
Thanks much! Minor change — you first click on “Mac OSX”, then there’s XCode Tools in the resulting list.
Q said on March 1, 2009
word
Anonymous Coward said on March 7, 2009
srsly? 1+GB for freaking gcc? that is RIDIC!
Ali said on March 17, 2009
Hi,
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)
Cheers!
Liftchair said on April 4, 2009
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).
denver real estate said on April 30, 2009
I like the Apple sucks for 1GB download for GCC. It is really good. Try!
thatguy said on May 23, 2009
GCC-4.0 requires 95mb when installed from your OS X DVD.
thatguy said on May 23, 2009
GCC-4.0 requires 95mb when installed from your OS X DVD.
Witek said on June 21, 2009
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 http://discussions.apple.com/message.jspa?messageID=7769749
J.C. said on July 5, 2009
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. said on July 5, 2009
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).”
Sorry
R said on August 19, 2009
Hi,
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 said on August 19, 2009
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 said on August 19, 2009
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 said on October 16, 2009
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 said on November 6, 2009
thank you for writing this helpful notes.
Can you tell me how to install CGAL in MAC
Kurt Bigler said on November 7, 2009
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 said on November 7, 2009
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 said on November 14, 2009
hello
do you know how to install ns-2.34 on mac os 10.5.5
I all ready have XCODE 3.1.1
thnx ,
lift chairs said on November 23, 2009
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 said on December 3, 2009
well done.
For more jobs visit http://www.staffingpower.com
AMIT RAUT said on February 5, 2010
RUN / CONSOLE OPTIONS ARE UNAVAILABLE FOR ANY FILE CREATED
PLZ HELP ME WHAT SHOULD I DO??????
Anonymous said on April 5, 2010
As of April 4th 2010:
Once logged into connect.apple.com, click Developer Tools, then click Xcode 3.2.1 Developer DVD (Disk Image)
isak said on May 19, 2010
same address – but the topic is called “Xcode 3.2.2 Developer Tools” and it is called Disc Image, not CD Image.
Anonymous said on June 26, 2010
someone have recompiled for Mac OS X Leopard?
of mesothelioma said on August 1, 2010
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 offset..eg 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 said on August 10, 2010
This is retarded. 1 GB for a gcc compiler?
cari said on August 24, 2010
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 said on August 25, 2010
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 said on September 10, 2010
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 said on September 10, 2010
whoops
*sorry, but osx is for children with over-protective parents
George Jost said on September 20, 2010
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?
Jnkm 89 said on October 23, 2010
you can get gcc from their website ( http://gcc.gnu.org/ ) 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 said on November 21, 2010
how do you install it on mac from the website?
sam said on February 18, 2011
It’s not just a gcc compiler, it’s a whole development package including many other applications.
keshav said on May 1, 2011
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 said on June 24, 2011
It looks like apple is forcing us to pay $100 to get this xcode software, is there another way?
Rebegol said on June 25, 2011
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.
Mem4sports said on July 19, 2011
Quinn can you convert on a mac a doc that looks like a page which should really be a zip file?
Allen Liu said on September 3, 2011
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 said on September 13, 2011
Try:
/Developer/Applications/Xcode
it works beautifully !
tokeiten said on September 13, 2011
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 said on January 16, 2012
Does not work. You have to pay to download Xcode. I still need GCC, tho.
Kebman said on January 16, 2012
My bad, seems to work now. :p Had some problems downloading Xcode for older OS X’es.