If you have installed Xcode and didn’t delete the previous ones then it will store xcode app is Xcode 2.app and Xcode 3.app and so on..
Now, when you will try to go to the directory such as /Applications/Xcode 4.app/Contents/Developer then terminal will give an error.
Try renaming your Xcode app without space e.g. Xcode4.app and now run the command !
xcode-select: error: invalid argument '4.app/Contents/Developer'
Usage: xcode-select [options]
Print or change the path to the active developer directory. This directory
controls which tools are used for the Xcode command line tools (for example,
xcodebuild) as well as the BSD development commands (such as cc and make).
-h, --help print this help message and exit
-p, --print-path print the path of the active developer directory
-s <path>, --switch <path> set the path for the active developer directory
--install open a dialog for installation of the command line developer tools
-v, --version print the xcode-select version
-r, –reset reset to the default command line tools path