Might be you are having more than one Xcode in your machine either delete others or
Just follow these steps
1 Open Xcode and go to its preferences.
2 Then open Location tab
3 In command line tools select the Xcode version that you are using . it might be possible that this entry is wrong