MacPorts can't recognize Xcode version properly I've tried to run the following command to install "automake" package on my Mac:

MacBook:~ administrator$ sudo port install automake
Password:
Error: The installed version of Xcode (5.1.1) is too old to use on the installed OS version. Version 6.1 or later is recommended on Mac OS X 10.10.
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets
Error: Processing of port automake failed


The problem is shown in the line: 


  Error: The installed version of Xcode (5.1.1) is too old to use on the
  installed OS version. Version 6.1 or later is recommended on Mac OS X
  10.10.


But there is Xcode 6.1 installed on my Mac. I'm using OS X 10.10 Yosemite (MacPorts for 10.10 already installed).
You need to run xcode-select --switch [path] as descriped here: https://stackoverflow.com/questions/9600615/xcode-stops-working-after-set-xcode-select-switch

And here is Apples documentation: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcode-select.1.html