Missing C++ header <__debug> after updating OSX Command Line Tools 6.3

Solution 1:

Downgrade the Command Line Tools to 6.2 via Apple's Developer Download Page.

Be careful to download the correct version for your OS X:

  • OS X 10.10 commandlinetoolsosx10.10forxcode6.2.dmg
  • OS X 10.9 commandlinetoolsosx10.9forxcode6.2.dmg

This works because the inclusion of __debug is conditionally guarded as follows in Command Line Tools 6.2 but not in 6.3.

#ifdef _LIBCPP_DEBUG
#   include <__debug>
#else
#   define _LIBCPP_ASSERT(x, m) ((void)0)
#endif

In my opinion this is the safest way, because:

  1. You don't compromise your toolchain
  2. You can easily upgrade via the App Store when Apple fixes the issue
  3. If you add a file manually you have to delete it later or more problems could occur

Update - 21.04.2015

Problem fixed by Apple. After installing Command Line Tools 6.3.1 everything works as expected!

Solution 2:

Temporarily create the missing __debug file where _LIBCPP_ASSERT is defined as in Command Line Tools 6.2 for OS X.

echo '#define _LIBCPP_ASSERT(x, m) ((void)0)' | sudo tee -a /Library/Developer/CommandLineTools/usr/include/c++/v1/__debug > /dev/null

Remove the temporary file after the build finished.

sudo rm /Library/Developer/CommandLineTools/usr/include/c++/v1/__debug

Solution 3:

Warning!!! This is a hack, use at your own risk!!! This work-around is only meant as a temporary fix until Apple provides an update to the command-line tools.

OK, here we go: Create the file yourself and put the following content into it:

#ifndef _LIBCPP_ASSERT
#define _LIBCPP_ASSERT(...) ((void)0)
#endif

This seems to work for me, but it is certainly not the right thing to do. Make sure the file is located at the right place /Library/Developer/CommandLineTools/usr/include/c++/v1/__debug with the right owner/permissions.

Solution 4:

This is now fixed in Command Line Tools 6.3.1, available from https://developer.apple.com/downloads. The update should appear automatically in your App Store Updates (though it’s labelled as 6.3, not 6.3.1). Apologies for the inconvenience, and thanks very much for reporting the issue.

Earlier: A workaround which worked for me in a simple case was setting a minimum of OS X 10.8 or earlier, with “-mmacosx-version-min=10.8”.