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.
WhereAmI (1.02)
paulgrav built a new binary that runs on 10.8 (download). This is my personal recommendation, because it’s so simple, and has the best error reporting.
Output style:
Latitude: 63.518321
Longitude: 3.431305
Accuracy (m): 65.000000
Timestamp: 04.01.13 18:20:13 MEZ
LocateMe (0.2)
Works if binary is moved to /Applications
.
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
corelocationcli
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