Installing Qt is (usually) an easy task: Download the installer, let it do its duty and done you are. This is certainly applicable if you want your Qt IDE to run on Windows, but when it comes to OS X you are very likely to run into the installer error clang install_name_tool failed. I want to explain what clang is, and why its absence (yes, that error message shall indicate its absence - I was surprised too!) causes the installation to fail. I needed quite a bit of time and a hint from a colleague to find out what was wrong, and since not everyone has the luck of having a colleague who happens to know the answer to most of the problems Qt offers you, I decided to share the solution to the mysterious error clang install_name_tool failed error - Which is as easy as big the surprise is when the error hits you for the first time.
Background - What gets installed?
The setup installs the Qt Creator and the Qt binaries. In addition to that they attempt to configure clang, a C++ compiler, and a failed configuration attempt leads to the already mentioned error message. If that error occurs, you can still run Qt based apps on your Mac and the Qt Creator will still start as nothing happened. The trouble starts when you try to compile your code: It won't, because Qt uses clang via the Xcode Command Line Tools.
Fixing the Issue
After a lot of research and talking to a coworker who happens to be some sort of a Qt Guru I eventually found out the problem: Qt access clang via the Command Line Tools, and these tools are not shipped with every version of Xcode. What surprised me the most is that this is nowhere mentioned if you look at the Qt download page - Not a single word, even though many developers will stumble upon the sane issue. Whatsoever, installing the Command Line Tools is fairly easy if you are already familiar with Xcode, and for those who are new to Xcode it is not that big kind of a deal, either.
Start Xcode - Make sure that you have installed the latest and greatest version, and applied all the updates:
Open the preferences. You can find them in the Xcode status bar, under Xcode -> Preferences.
Select the tab Downloads -> Components. You can see an item Command Line Tools in the List. Click on Install and Xcode starts downloading and installing the Command Line Tools.
After the installation has completed you can install Qt flawlessly with the corresponding installer.
Fixing Xcode is not installed in /Developer/Xcode.app/Contents/Developer
Those who never had Qt installed before most likely encounter the error Xcode is not installed in /Developer/Xcode.app/Contents/Developer when trying to build a project - The solution is easy to find, but added here for completeness. The error has historical roots - Qt still tries to access Xcode in the path /Developer/Xcode.app/Contents/Developer - but Apple has moved the installation to /Applications/Xcode.app/Contents/Developer. I can only guess why they did that, suspecting that the intend was to have Xcode in the location where it belongs: It's and application, so it shall be accessible under /Applications. Enough talking, enter the following command in the Terminal and the error shall be a thing from the past:
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer
This behavior is documented as a bug of Qt 5.2 - Details can be found in the Qt Bug 31878 description.
I'm a young Software Engineer. Whilst I may accept a 'status quo' as given, it's my responsibility to improve it as soon as the opportunity arises.
Very familiar with the .Net framework since it has been the underlying foundation for most of my professional work so far. I'm that kind of guy who gets stuff done, while I may also improve the way things work whilst I'm at it. Generally can get along well with most people I meet as a professional.
Fervent volunteer firefigter, captain-ranked air force militia spec officer.
Great friend and generally nice to have me around - For a talk, a beer, or a bonfire (I might as well do all of those things combined). Oh, and I really love music - Rock & country that is, mostly.