Drarok
Drarok

Reputation: 3809

How do I run gcc on the command-line after installing Xcode 4.2 on Mac OS X 10.6?

It would appear that installing Xcode 4.2 on my Mac OS X 10.6 machine has effectively removed gcc. In place of the binaries, there are now symlinks like so:

/usr/bin drarok$ ls -la | grep gcc
lrwxr-xr-x     1 root   wheel        32 13 Oct 14:27 cc -> ../llvm-gcc-4.2/bin/llvm-gcc-4.2
lrwxr-xr-x     1 root   wheel        12 13 Oct 14:24 gcc -> llvm-gcc-4.2
lrwxr-xr-x     1 root   wheel        12 12 Sep 16:15 gcc-4.2 -> /usr/bin/gcc
...

So "gcc-4.2", despite looking like gcc of old, results in an llvm binary being executing.

Is there still a way to run gcc on my Mac?

Note: I am not looking to configure my Xcode to use gcc - this has been covered in other SO questions. I have some command-line tools that must be built with real gcc. My Cocoa projects all work with llvm.

Upvotes: 1

Views: 2276

Answers (1)

Michael Dautermann
Michael Dautermann

Reputation: 89509

I understand your pain. I still have gcc installed somehow:

[/usr/bin]:;ls -la | egrep gcc
lrwxr-xr-x     1 root   wheel          32 Oct 15 00:33 cc -> ../llvm-gcc-4.2/bin/llvm-gcc-4.2
lrwxr-xr-x     1 root   wheel          12 Oct 15 00:30 gcc -> llvm-gcc-4.2
-rwxr-xr-x     1 root   wheel       97392 Oct 24  2010 gcc-4.0
-rwxr-xr-x     1 root   wheel      166128 Feb 11  2011 gcc-4.2
lrwxr-xr-x     1 root   wheel          28 Oct 15 00:30 gcov-4.2 -> ../llvm-gcc-4.2/bin/gcov-4.2
-rwxr-xr-x     1 root   wheel      369696 Oct 24  2010 i686-apple-darwin10-gcc-4.0.1
-rwxr-xr-x     1 root   wheel      816560 Feb 11  2011 i686-apple-darwin10-gcc-4.2.1
lrwxr-xr-x     1 root   admin          52 Oct 15 00:30 i686-apple-darwin10-llvm-g++-4.2 -> ../llvm-gcc-4.2/bin/i686-apple-darwin10-llvm-g++-4.2
lrwxr-xr-x     1 root   admin          52 Oct 15 00:30 i686-apple-darwin10-llvm-gcc-4.2 -> ../llvm-gcc-4.2/bin/i686-apple-darwin10-llvm-gcc-4.2
lrwxr-xr-x     1 root   admin          32 Oct 15 00:30 llvm-cpp-4.2 -> ../llvm-gcc-4.2/bin/llvm-cpp-4.2
lrwxr-xr-x     1 root   admin          32 Oct 15 00:30 llvm-g++ -> ../llvm-gcc-4.2/bin/llvm-g++-4.2
lrwxr-xr-x     1 root   admin          32 Oct 15 00:30 llvm-g++-4.2 -> ../llvm-gcc-4.2/bin/llvm-g++-4.2
lrwxr-xr-x     1 root   admin          32 Oct 15 00:30 llvm-gcc -> ../llvm-gcc-4.2/bin/llvm-gcc-4.2
lrwxr-xr-x     1 root   admin          32 Oct 15 00:30 llvm-gcc-4.2 -> ../llvm-gcc-4.2/bin/llvm-gcc-4.2
-rwxr-xr-x     1 root   wheel      373792 Oct 24  2010 powerpc-apple-darwin10-gcc-4.0.1
-rwxr-xr-x     1 root   wheel      820496 Feb 11  2011 powerpc-apple-darwin10-gcc-4.2.1
[/usr/bin]:;./gcc-4.2 -v
Using built-in specs.
Target: i686-apple-darwin10
Configured with: /var/tmp/gcc/gcc-5666.3~123/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin10 --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 --target=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)

But this may be because I also have XCode 3 tools installed?

In any event, check out this very fancy Open Source project:

https://github.com/kennethreitz/osx-gcc-installer

Which I found in this related question: GCC without Xcode on OS X

Upvotes: 2

Related Questions