How to compile with Command Line Tools for Xcode after deleting the Xcode.app application bundle

developmentgccterminalxcode

I first had Command Line Tools for Xcode installed and then installed the Xcode app. I have now deleted the Xcode.app application bundle but still have Command Line Tools for Xcode installed.

However, now when I try to compile via Terminal it says:

xcrun: error: active developer path ("/Volumes/Macintosh HD/Applications/Xcode.app/Contents/Developer") does not exist, use xcode-select --switch path/to/Xcode.app to specify the Xcode that you wish to use for command line developer tools (or see man xcode-select)

Before I had the Xcode.app installed, it compiled just fine via the Command Line Tools for Xcode. How can I again compile via Command Line Tools for Xcode now that I've deleted the Xcode application bundle?

Best Answer

If you now only have the Command Line Tools for Xcode installed and having deleted the Xcode.app application bundle, then you need to run the following command in Terminal to use the Command Line Tools for Xcode.

xcode-select -switch /Library/Developer/CommandLineTools