Error: xcode-select: error: tool ‘xcodebuild’ requires Xcode, but active developer directory is a command line tools instance

This is from my old blog, it is one of more popular post so copying here. I had been playing with Cordova then and was getting this error when building iOS version:

Full re-install of Xcode didn’t fix this error. The solution was to run following command: