Skip to main content
8 of 12
dropped tag from title
Dan J
  • 5.8k
  • 15
  • 48
  • 72

Is there a way to access a Mac's geolocation from terminal?

(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!

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 (0.1b)

Works if binary is moved to /Applications, but feels rather unfinished anyway.
Output style (continuously, app does not finish!)

<+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
myhd
  • 3.5k
  • 6
  • 30
  • 62