Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using gcc not llvm-gcc with Mac OS X Lion

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?

like image 551
prosseek Avatar asked Jan 03 '12 02:01

prosseek


People also ask

Does macOS have LLVM?

All of Apple's operating systems, iOS, macOS, tvOS and watchOS, are built with LLVM technologies.

Does Mac use gcc or clang?

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.

How do I find gcc version on Mac?

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.


2 Answers

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.

like image 120
Ned Deily Avatar answered Oct 17 '22 12:10

Ned Deily


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

like image 3
prosseek Avatar answered Oct 17 '22 14:10

prosseek