gcc
is symbolically linked to llvm-gcc
on Mac OS X Lion.
prosseek ~> ls -alF /usr/bin/gcc
lrwxr-xr-x 1 root wheel 12 Nov 12 14:39 /usr/bin/gcc@ -> llvm-gcc-4.2
How can I setup to use gcc-4.2
when gcc
is called?
All of Apple's operating systems, iOS, macOS, tvOS and watchOS, are built with LLVM technologies.
Apple ships the clang/LLVM compiler with macOS. Clang is a "front-end" that can parse C , C++ and Objective-C down to something that LLVM (referred to as a "back-end") can compile. Clang/LLVM is located in /Applications/Xcode.
You can run brew info gcc to get path where it is installed and get exact name of the binary by listing the directory. $ brew info gcc gcc: stable 11.2. 0 (bottled), HEAD GNU compiler collection https://gcc.gnu.org/ /usr/local/Cellar/gcc/11.2.
As of Xcode 4.2 in Lion, Apple no longer ships its previous version of gcc-4.2
, which was in Xcode 4.1 and earlier versions. It now only ships llvm-gcc
(gcc front-end with llvm
code backend) and clang
(clang front-end with llvm
backend). While it is possible to install legacy versions of vanilla GNU gcc-4.2 from other sources, like MacPorts, (and without disturbing /usr/bin
), Apple has made it clear that they aren't going to be supporting gcc
anymore and that they want developers and users to move to clang
.
There seems to be a way to use gcc with Xcode 4.2 - http://caiustheory.com/install-gcc-421-apple-build-56663-with-xcode-42
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With