25

How do I determine what version(s) of xcode command line tools I have?

I tried doing

$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.1.0
Thread model: posix

Is the Apple LLVM version the same as the version of xcode command line tools?

  • +1. It was really hard to craft a Google search to find an answer to this. I searched xcode command line tools installed version but got a lot of irrelevant matches. Btw, did Dog G.'s answer work for you? – Kelvin Jun 15 '16 at 18:20
28

Finding the CLI version number depends on the combination of which particular OS and which particular CLI Tools are installed. One of these should work:

On Yosemite & Mavericks:

pkgutil --pkg-info=com.apple.pkg.CLTools_Executables

on Mountain Lion:

pkgutil --pkg-info=com.apple.pkg.DeveloperToolsCLI
  • 5
    If they ever change the pkg name again, running pkgutil --pkgs | grep -i tools should help locate it. – Kelvin Jun 15 '16 at 18:29
1

I'm answering against the more recent version (where the tools actually are in the Xcode.app pkg, but I'm pretty sure that if the path & output returned by xcode-select -p, gcc -v, and llvm-gcc -v/clang -v are harmonious then they should be the same, i.e.

$ xcode-select -p
/Applications/Xcode.app/Contents/Developer

$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.3.0
Thread model: posix

$ llvm-gcc -v
Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.3.0
Thread model: posix

$ clang -v
Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.3.0
Thread model: posix

Note that llvm-gcc is a link to clang,

$ls -al /usr/bin/llvm-gcc
lrwxr-xr-x  1 root  wheel  5 Oct 19  2014 /usr/bin/llvm-gcc -> clang

so the output of llvm-gcc -v and clang -v should be identical although that may or may not be the case for you (see https://stackoverflow.com/a/5708732/602581 for some more details)

  • 1
    The version that these tools output isn't necessarily the same as the Xcode command line tools version. Example, clang --version returns Apple LLVM version 7.3.0 (clang-703.0.31), while Doc G.'s pkgutil command returns version: 7.3.1.0.1.1461711523. – Kelvin Jun 15 '16 at 18:28
1

In terminal do

$ /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -version

example output:

Xcode 10.1
Build version 10B61

(adapted from https://www.garron.me/en/bits/what-xcode-version-am-i-running.html).

  • Using Mojave here. xcodebuild -version was what I was looking for. – joeytwiddle Feb 25 at 6:11

You must log in to answer this question.

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