Many CUDA developers on Macs that migrated to Mavericks might have experienced one (or as in my case, all) of the following, a) clang: error: unsupported option '-dumpspecs', b) xcodebuild says it requires Xcode but you have Xcode installed already, and c) CUDA examples don’t compile or prompts cudaGetDeviceCount returned 35, maybe more. Here’s a work-around to just that.

To my suprise, this problem seems deeply rooted in the installation of Xcode. I’ve uninstalled and reinstalled it several times, but none seemed to work always. Different CUDA versions didn’t help either. It turns out all could be solved by simply typing these lines in your terminal

sudo mv /usr/bin/xcodebuild /usr/bin/xcodebuild~
sudo ln -s /Applications/ /usr/bin/xcodebuild

Here, we’re just backing up your original xcodebuild in your PATH and replacing it with a symlink to the Xcode installation. After doing these, make sure that in your DYLD_LIBRARY_PATH, /usr/lib comes before /usr/local/lib (Xcode seems unhappy about the latter).

Then? CUDA Samples and everything else that had these problems are all yours!