How can I find the actual Clang version on Mac?

17,987

Solution 1

launch terminal and enter:

clang --version

Apple clang version 11.0.0 (clang-1100.0.33.16)

Solution 2

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.

Solution 3

You could try using

echo | clang -dM -E - | grep __clang

and maybe that will give you more reliable numbers. Although I'm speculating since I'm not on a Mac.

Also, clang has had the -pedantic option for a long long time - many versions before 6.0. -pedantic is a GCC option and clang takes after GCC in its options.

Share:
17,987
Lone Learner
Author by

Lone Learner

Updated on June 28, 2022

Comments

  • Lone Learner
    Lone Learner almost 2 years

    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
    $
    
  • ng10
    ng10 over 4 years
    or g++ --version if you are using g++
  • Vittore Marcas
    Vittore Marcas over 2 years
    This answer takes me eight hours. But I think, Leave enough blank lines between each sentence to make it clearer. If I sacrifice the necessary blank lines, then I can edit it again.