back
103 comments
Unfortunately Apple's new Command Line Tools for Xcode doesn't include regular gcc, but Apple's gcc-compatible wrapper around LLVM (i.e. /usr/bin/gcc is a symlink that points to llvm-gcc).

llvm-gcc doesn't compile many projects correctly, including gcc itself (as of Xcode 4.2 there were reports that it's not possible to compile a gcc cross-compiler using llvm-gcc). Hopefully there have been improvements in this regard.

Still, anyone who needs the real gcc will have to install it through some other means.

GCC has been on the way out for a long time since they switched to GPLv3. The latest GCC version provided by Apple was 4.2 which is really quite outdated now.

Clang is a faster and BSD-licensed compiler that Apple is putting all its weight behind now. LLVM-GCC has also been deprecated as it was removed as-of LLVM 3.0.

Clang is the future and it's the default compiler with the Command Line Tools. We just need to wait for upstreams to fix the various issues.

It's worth noting that this is why monocultures are bad. For all the love of GCC (and it is great) we now have a huge quantity of open-source software that only compiles with one compiler. This is a shame and hopefully Clang will help rectify that.

That also means a huge amount of open source software that makes OS X more useful (esp. as a developer OS) is going to get harder and harder to compile on OS X. Which in turn is making OS X a less attractive platform.
Yes, but the current Xcode doesn't include non-llvm gcc, so it isn't really a surprise that the Command Line Tools for Xcode doesn't include it either.
I ran into this problem, myself, after I upgraded Xcode a while back. Fink was no longer able to build a tool I wanted to install.

I wonder if there's a compelling reason for these add-on distros (Fink, Homebrew, Macports) to be strictly "build from source" with no option for binary package downloads. For me, it just seems to add long delays in getting a tool installed, and adds frustrating dependencies on my Xcode version.

> I wonder if there's a compelling reason for these add-on distros (Fink, Homebrew, Macports) to be strictly "build from source" with no option for binary package downloads.

For that to happen, someone has to take responsibility for creating, managing, and distributing those binary packages. That's much easier said than done.

So, the simple answer is that no one has, as of yet, volunteered to do the work.

Homebrew does have binary packages (we call them bottles). I'm the guy who implemented the feature and I am realising that as I didn't shout very loudly people don't realise that it exists.

For example Qt has a bottle: https://github.com/mxcl/homebrew/blob/master/Library/Formula...

The reason we aren't doing this for more packages is basically people power and hosting (as I'm not sure Sourceforge would be happy we hosting the number of binaries we'd want to have).

Hope that explains a bit. Feel free to comment if you think we're taking a good/bad approach here.

Since 2.0, Macports can install binaries if available.

http://lists.macosforge.org/pipermail/macports-users/2011-Ju...

In my experience, those are quite common now - most of the packages I install are delivered as binaries.

> llvm-gcc doesn't compile many projects correctly, including gcc itself

While strictly true, it's kind of irrelevant. The official stance is that GCC is the only compiler that is supported to build recent versions of GCC. This has been true since some point around GCC 4.0.

Presuming one can get it to compile; is there any reason we can't have gcc in Homebrew now? Since it's not included anymore, it doesn't clobber any default software[1] (anything that expects `gcc` to be ordinary gcc stands a chance of breaking anyway)

[1] https://github.com/mxcl/homebrew/wiki/Acceptable-Formula

I doubt that a five year old GCC would much better choice for average developer/homebrew-user.
Here's what I recommend for installing "real" gcc: http://caiustheory.com/install-gcc-421-apple-build-56663-wit...
Why is it not possible to compile gcc with llvm-gcc? The last time I checked llvm-gcc compiles C and C++ with most GNU extensions.
Does clang compile these projects correctly? If not, have you filed a bug? (http://llvm.org/docs/HowToSubmitABug.html)
You really shouldn't be using terms like "regular gcc" or "real gcc", they don't mean what you seem to think they do. GCC is a modular system specifically to provide for things like LLVM-GCC. LLVM-GCC takes the same form as other GCC back-ends for other platforms. i386 has a GCC backend, ARM has a GCC backend, IA64, MIPS, SPARC... Which of these do you nominate to be "real gcc"?

The only measure by which llvm-gcc is not "real" is that it's not included in the core gcc distribution.

When people listen to each other, wonderful things happen. Thank you for listening, Apple.
Indeed, this also gives me some confidence that there are still a few people around at Apple who don't like walls around their gardens :)
Definitely. For instance, X is still supported on OS X after all these years, in large part due to Jeremy Huddleston:

http://lists.apple.com/archives/x11-users/2011/Nov/msg00058....

It's reassuring that I will be able to continue to use my Mac and rxvt-unicode into the forseeable future.

This is indeed great news. Thanks to everyone who was involved in making this happen, it's fantastic news.
While this is a nice convenience for registered Apple developers, I noticed that this download requires me to sign a confidentiality agreement and an NDA as part of the registration process (since I am NOT a registered Apple developer).

The nice thing about just installing the OS X developer tools off the OS X DVD is that you do not need to enter into these sorts of legal agreements with Apple (beyond a standard software EULA).

It's a preview. The final version won't.
The NDA covers prerelease software, which this is not.
Apple requires developers to "register" and sign NDAs to download a command-line gcc? For real?

It seems not a week goes by without another reason to be glad I never touch that platform.

Fellow software developers, show some self respect. Quit enabling this abuse.

"We will recommend you don't use Xcode from the App Store but instead the command-line-tools package"

Ok why? If you install all of Xcode, you're going to have everything included in this tools package as well, aren't you?

I'm inferring that they are saying this to the people that only need GCC for homebrew. I don't use Xcode for anything and I hate the idea of installing all of it on my small SSD just for GCC. I've used his OSX-GCC package before and can't wait to use the "official" version now. Kudos!
No it doesn't. Xcode 4.3 is now a standalone .app package including only what is relevant to Xcode. These command line tools are a separate install even if you installed Xcode.
Does anyone happen to know if this covers OSX developer header files like Appkit/Appkit.h? Emacs via Homebrew requires them to build, and they weren't included in the GCC for OSX package.
It's in the article. He says it includes OS X header files that he couldn't include in the other package.
> Before installing, note that from within Terminal you can use the XCRUN tool to launch compilers and other tools embedded within the Xcode application. Use the XCODE-SELECT tool to define which version of Xcode is active. Type "man xcrun" from within Terminal to find out more.

> Downloading this package will install copies of the core command line tools and system headers into system folders, including the LLVM compiler, linker, and build tools.

"All you need is a free Apple ID" - seriously Apple, what is with tracking me every time I try to use my computer for something non-trivial?
"Open source is incredible."

Yup, I agree. Also, with the news of Mountain Lion today, I've been worried about how much Apple will continue making OS X a platform that any developer can innovate on. This story has re-affirmed that further for me. Awesome!

I've found a problem with CMAKE and gcc from the latest Xcode command-line tools. CMAKE simply can't discover the ABI. I've tried gcc, gcc-apple-4.2, llvm-gcc, but finally it was "clang" that worked.

So for anyone using CMAKE, and having problems, this might save you (I was able to recompile GLFW and CEGUI this way):

CMAKE_C_COMPILER=clang

CMAKE_CXX_COMPILER=clang++

One problem I'm finding is that Ruby refuses to compile on this setup, giving the following prompt instead:

http://cl.ly/EIbT

I'm assuming this is because of Apple's GCC build just being wrappers around LLVM.

As of 1.9.3-p125, clang is officially supported by MRI.

If ruby-build refuses to compile with clang, you should open an issue. I've done so for rvm: https://github.com/wayneeseguin/rvm/issues/763

Having the same issue here.

And I'm guessing, from the submitted article, re-installing 'osx-gcc-installer' wouldn't work.

Hopefully, Ruby will work with newer tools soon.

Tell ruby to fix their shit and use clang instead.
That huge multi-gig download and install of Xcode is one reason I had for leaving OS X for linux. The hurdle for getting FOSS software was too big.
How is a one-time download while setting up your system of any significance at all? Sure sounds like picking a screwdriver based on how fast you can unbox it.
IAWTC. I'm on the fence about making the move from OS X to Linux. I've spent far too much time fighting unnecessarily complicated issues like this in the Mac environment. GCC issues. Lion Segfaults. MacPorts. Homebrew. Headaches.

Almost all of the tools I need I can install in minutes in Debian with apt-get. It's reliable, easy and gets me doing work instead of crying while I open 20 tabs trying to find solutions to obscure bugs on Google.

How big was your distro's installer download?
Well now with this new small download you can come back to OS X then! :-)
I remember a terrible experience trying to get gfortran working on osx. I ended up permanently borking my glibc. If this doesn't use the real gcc I imagine similar experiences may await. Nonetheless that is much better than downloading xcode just for GCC.
Apple doesn't use glibc.
can this live side by side the existing xcode system?
> You can now setup a complete OS X develop environment with a single 171.7 MB package download.

And then, I LOLed.

It was 4GB.