clang: error: unable to locate xcodebuild

10,116
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer 

worked like a charm for me

Share:
10,116
ctt25
Author by

ctt25

Updated on June 04, 2022

Comments

  • ctt25
    ctt25 almost 2 years

    I am using a mac version 10.13.6.

    I want to compile C programs through the terminal. I've downloaded Xcode and the command line tools. When I type clang --version in the terminal, I get the following two error messages:

    clang: error: unable to locate xcodebuild, please make sure the path to the Xcode folder is set correctly!

    clang: error: You can set the path to the Xcode folder using /usr/bin/xcode-select -switch

    I did some googling and found a fix here. The solution is to run the following line in terminal:

    sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

    Which I did. But when I enter clang --version after doing this, I get exactly the same two errors. What's going on?

    NB: very very new to this so please keep that in mind when answering! cheers