(Note the Mountain Lion update at end of question)
Some GUI apps use OS X location services, but I want to retrieve a Mac's physical location from the command line. This could be useful for running scripts, switching settings etc. The mechanism should be CoreLocation, not a Geo IP service (data too low-res, needs online connection).
Minimum requirement is output of longitude and latitude. Nice would be a number indicating the precision. Super nice: a geocoder that provides location names.
Update for Mountain Lion: The result of my 100 points bounty is: We have three working versions for OS X 10.8. Thanks to all involved!
Latitude: 63.518321 Longitude: 3.431305 Accuracy (m): 65.000000 Timestamp: 04.01.13 18:20:13 MEZ
Works if binary is moved to
Output style (linebroken for readability):
<+63.518321,+3.431305> +/- 65.00m (speed -1.00 mps / course -1.00) @ 04.01.13 18:22:48 Mitteleuropäische Winterzeit
A summer 2014 version now supports single and continuous output of location data (see comment below). Output style:
<+51.91892126,+4.45120488> +/- 65.00m (speed -1.00 mps / course -1.00) @ 04.01.13 18:22:48 Mitteleuropäische Winterzeit <+51.91902353,+4.45133598> +/- 65.00m (speed -1.00 mps / course -1.00) @ 04.01.13 18:26:17 Mitteleuropäische Winterzeit <+51.91894650,+4.45124279> +/- 65.00m (speed -1.00 mps / course -1.00) @ 04.01.13 18:26:18 Mitteleuropäische Winterzeit