Command Line Tools is not installing correctly on Mavericks - xcode

I've upgraded Xcode to the latest 5.1
Installed Command Line Tools via xcode-select --install
Homebrew tells me "A newer Command Line Tools release is available"
brew --config:
Xcode: 5.1
CLT: 5.1.0.0.1.1393561416
LLVM-GCC: build 2336
Clang: 3.1 build 318
Checking my clang executable:
$ /usr/bin/clang --version
Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
$ /Library/Developer/CommandLineTools/usr/bin/clang --version
Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
So it appears Command Line Tools didn't install clang (and perhaps other executables) into /usr/bin? I checked my other laptop (w/ Mavericks), and /usr/bin/clang is version 5.1.
So I'm guessing this is the problem? I've tried to reinstall Command Line Tools as sudo, but now it won't let me install again (says software isn't currently available).
Can anyone help me with this? I've spent hours on it now, but can't find a solution.
Thanks

Related

How can I upgrade the built-in Apple Clang on MacOS?

My clang on MacOS that is provided by Apple seems to be a bit outdated.
> clang -v
Apple clang version 12.0.5 (clang-1205.0.22.9)
Target: arm64-apple-darwin22.1.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
But my MacOS is up to date: MacOS Ventura 13.0.1
I have recently installed Xcode version 14.1,
but I think the Xcode developer tools (CLI tools) are installed independently.
How can I upgrade the clang that is provided by Apple on MacOS?
According to Xcode on Wikipedia it looks like the clang used by Xcode is newer.
Some command outputs:
>where clang
/usr/bin/clang
>xcode-select -p
/Library/Developer/CommandLineTools
>sudo xcode-select -r
xcode-select -p
/Applications/Xcode.app/Contents/Developer
This looks like you've got remnants of an Xcode 12.5 installation on your system.
Things I would try/check:
what does where clang say? Is it /usr/bin/clang?
what's the output of xcode-select -p? It should be something like /Applications/Xcode.app/Contents/Developer (depending on where/how you installed Xcode).
If the output doesn't look right, try xcode-select -s <path> with the path to your Xcode installation, or try resetting with xcode-select -r
running sudo xcode-select --install may force a new installation of the commandline tools
In any case, the output of clang -v on my Ventura box is
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: arm64-apple-darwin22.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
as one would expect.

Which version of gcc is installed on Mac (Yosemite)

I am confused by what version of gcc is installed on my Mac, which is has OS X Yosemite (10.10.5) installed on it. I also have Xcode v6.3.1 installed.
Entering the commands below reveals the following info:
gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/c++/4.2.1
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
clang -v
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
which gcc
/usr/bin/gcc
which clang
/usr/bin/clang
As far as I can tell, gcc is not aliased to clang.
Can someone please enlighten me what this means?
In newer versions of XCode gcc and clang are linked to the same binary in the SDK. clang will say that it's at least gcc 4.2, this is a little weird, but works for lots of software that checks for gcc and it is compatible in general.
echristo#dzur ~> /usr/bin/clang -v
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
echristo#dzur ~> /usr/bin/gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
If you take a look at the directory InstalledDir you can see the programs that are actually there.
I had a similar problem, I wanted to know what version of gcc should I install on my Yosemite, since most of UNIX tools need GCC it is a vital package.
if gcc -version doesn't shows the version, it means you do not have one.
you need to install a gcc first, then check for its version! funny? but according to your Xcode command line and OS version you have not a lot of options, let the brew decide which version you should install, It also installs dependencies.
To install GCC,
install Homebrew From HomeBrew Website
Open Terminal
Run command: brew install gcc
I have installed my GCC just now, here is the snapshot, notice the dependent module names and the gcc version at the following picture, they are Yosemite tailored :

port select --list gcc returns none(active)

I am running Yosemite and get xcode 6.1 installed on it. I also installed manually gcc with brew install gcc command.
However when i run port select --list gcc command, it returns the following message
Available versions for gcc:
none (active)
the gcc version shows clang with LLVM.
gcc --version
Configured with: --prefix=/Volumes/DEV/Applications/Xcode.app/Contents/Developer/usr -- with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix

using command-line clang, OS X 10.9.1, Xcode 5.0.2

I'd like to use the -fsanitize=address features of clang.
I'm on:
OS X 10.9.1 with Xcode 5.0.2
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
I'm running clang from the command line, and I'm getting the error:
clang: error: unsupported argument 'address' to option 'fsanitize='
I'm told this works, but searching around hasn't shown me the way; do I need to bring in a different version of clang?
Thanks!
The out-of-box version of clang on OS X does not implement support of Address Sanitizer. You will have to build your own version of clang from sources.
You need a different build of clang than the one apple gave you. The simplest way to get one (or more) is to install Homebrew http://brew.sh
and then
brew install llvm --with-asan
You could also try a prebuilt clang from http://llvm.org/releases/download.htm.
It's by no means impossible to build clang 'by hand', but last I checked it did take multiple checkouts to get the source tree. The other options should have you asaning in minutes.

Installing Clang on Mac

This is the first time I am working on Mac and I wanted to install the latest version of Clang, so I installed Xcode 5 and Xcode command line tools.
But the Clang version I got from the Xcode (in the terminal, I typed clang --version). It gives me following output:
clang++ --version
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix
I am confused what Clang version it is. I read that the latest Clang is version 3.5. Is the one above similar? (I need complete support for C++11). What is the difference?
Apple uses its own version numbers for Clang and LLVM which correspond with the Xcode version they are bundled with.
The actual Clang version is in indicated by the (based on LLVM X.Xsvn) part. So you have version 3.3, which is the most recent official release as you can see from the LLVM website. That version implements all the major C++11 features as you can see from the C++ support status page.

Resources