jonathan topf
jonathan topf

Reputation: 8367

change default compiler on osx from llvm-g++ to g++

I'd like to change my default compiler from llvm-g++ to g++ on osx, whats the cleanest/simplest way to do this?

Upvotes: 0

Views: 550

Answers (1)

Konrad Rudolph
Konrad Rudolph

Reputation: 545943

There is no “default” compiler as such. The operating system is compiler unaware. Tools will choose different compilers depending on different factors. Xcode for instance can be configured to use a different default compiler.

If, on the other hand, you want to configure your terminal to use a different default compiler, simply adjust the $PATH variable so that your GCC installation is found before your LLVM installation. In the simplest case, this can be done by adding the following line to your $HOME/.bashrc file (assuming you are using bash as the shell):

export PATH=path/to/gcc/:$PATH

(After that you need to reload your shell before the changes take effect.)

Upvotes: 1

Related Questions