Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find the actual Clang version on Mac?

Note: None of the answers provided at Get Apple clang version and corresponding upstream LLVM version seems to work anymore.

The download page at http://releases.llvm.org/download.html and the Wikipedia article at https://en.wikipedia.org/wiki/Clang seems to indicate that the most recent Clang version is 6.0.0.

But on my macOS High Sierra version 10.13.3, I see this output:

$ clang --version
Apple LLVM version 9.1.0 (clang-902.0.39.1)
Target: x86_64-apple-darwin17.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$ which clang
/usr/bin/clang

This does not seem right. Why is the Apple's version of Clang greater than the current version of Clang?

How do I find out which version of Clang hosted on http://releases.llvm.org/download.html does my Mac's version of Clang correspond to?

I ask this because I see http://releases.llvm.org/6.0.0/tools/clang/docs/UsersManual.html documenting a -pedantic option for the clang command line, but it is not documented in the man page of clang on my system.

$ man clang | grep pedantic
$ clang --help | grep pedantic
$
like image 793
Lone Learner Avatar asked May 17 '18 09:05

Lone Learner


People also ask

How do I find my Apple Clang version?

Wikipedia's Xcode page has a map of Apple to LLVM versions. The LLVM column has the open-source LLVM/Clang version. From this you can look up a language feature in cppreference's chart of compiler support for language features.

How do I know if Clang is installed on Mac?

Open a Terminal window. Enter the command clang --version to see if the Clang compilers are already installed.

What version of Clang does Xcode use?

Xcode's default toolchain bundled with clang 13. But clang bundled with Swift Open Source toolchain is 10 which behaves different to the default toolchain of current version of Xcode (Xcode 13.1) when compiling Swift project with C++ sources.

Does macOS come with Clang?

From Xcode 4.2, Clang is the default compiler for Mac OS X.


2 Answers

launch terminal and enter:

clang --version

Apple clang version 11.0.0 (clang-1100.0.33.16)

like image 170
Mark Avatar answered Oct 06 '22 00:10

Mark


This wikipedia table maps Xcode and Apple clang versions to LLVM versions. Your clang-902.0.39.1 appears to be based on LLVM 5.0.2.

like image 40
TimK Avatar answered Oct 05 '22 23:10

TimK