I need gcc as a default compiler to compile cuda samples and I need clang to compile my network projects because clang has better warnings and errors specifications.

Is there any way to run both compilers?

  • Why can't you run CUDA in clang? The cuda install page implies clang - and mixing two compilers if C++is problamatic and if C then surely which compiler does not matter
    – mmmmmm
    Nov 11, 2016 at 2:14

1 Answer 1


Yes you can.

Apple's Xcode supplies clang (and puts in /usr/bin/gcc a link to clang not gcc)

Then you can then install gcc - probably the easiest way is via a package manager like Macports, Homebrew or Fink


You must log in to answer this question.

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