I have a configure on Mountain Lion that's running into trouble:

checking for gcc...
checking whether the C compiler works... no
configure: error: in `/Users/jonathan/Downloads/httpd-2.4.4':
configure: error: C compiler cannot create executables
See `config.log' for more details

Meanwhile, I have just opened Xcode and installed command-like tools, including /usr/bin/gcc.

Is there a way I can invoke the configure script so it will take /usr/bin/gcc as the C compiler?

And when I specified:


It gives:

checking how to run the C preprocessor... /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc -E
configure: error: in `/Users/jonathan/Downloads/httpd-2.4.4':
configure: error: C preprocessor "/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc -E" fails sanity check
See `config.log' for more details

For now I'll ask: how do I tell it what to use as the C preprocessor?

(Long-term what I'd like is to know why it's not aware of standard command line tools and pulls C-related functionality from an esoteric place.

  • Perhaps I misunderstood your question. Did you check the config.log to make sure you are not writing to a directory where the current user has no write permission? This might be more of a configure issue and not a compiler issue at all.
    – bmike
    May 7, 2013 at 19:44
  • I didn't check config.log, but I was installing as root, which maybe doesn't work for mode 000 without changing permission, but should be enough privilege for what I was attempting. May 7, 2013 at 19:52
  • Yes - sudo or root should be more than enough to avoid any installation issues. If the installer is dropping things where there's an ACL or other explicit write lock, I'd be highly surprised.
    – bmike
    May 7, 2013 at 19:57
  • What is in config.log
    – mmmmmm
    May 7, 2013 at 21:00

1 Answer 1


Apple's gcc binary is really llvm.

Mac:~ bmike$ which gcc
Mac:~ bmike$ gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO

You'll want to obtain gcc from homebrew or from source if you need gcc and not llvm standing in for gcc.

Good reading abounds on various blogs:

Once you've gotten a real version of gcc installed, you can export CC=/usr/local/bin/gcc or whatever else you prefer for setting the environment variable to match were you choose to store your now non-llvm-based compiler.

  • However yoiu probably do not need a real gcc. llvm should be suffficient and in many cases is better.
    – mmmmmm
    May 7, 2013 at 21:00
  • Mark's right that in the long run, having your package build under LLVM is ideal, but often if you are downloading something that expects gcc and tests for gcc and fails when gcc isn't detected, just getting gcc is the expedient workaround.
    – bmike
    May 7, 2013 at 21:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .