How did it do that? Did it look up my IP address?
It uses a database of WiFi networks your Mac can see and their approximate locations to triangulate your position. This Apple article says:
Your approximate location is determined using information from local Wi-Fi networks, and is collected by Location Services in a manner that doesn’t personally identify you.
The location of WiFi networks is determined primarily using the GeoIP database and but well-established WiFi networks can report more accurate information to the system. For example, in my neighbourhood where only private citizen WiFi networks are visible to my Apple devices, my location is very approximate. It knows the town, but that's it.
How do I disable that? I definitely don't want any app to know my location (and send it back to god knows who), with or without my consent.
In 10.6.8, the only way to get location services is via Safari. The OS didn't have control over location services, it was just a browser feature. To turn off location services for websites in Safari:
- In Safari select Safari > Preferences… > Privacy (toolbar).
- Select the "Deny without prompting" radio button in the 'Limit website access to location services' section of that tab.
If you're running a new OS X you can also turn off location services for apps by doing:
- Apple () menu > System Preferences… > Security & Privacy > Privacy (tab).
- Select Location Services on the left.
- Uncheck the 'Enable location services' option to turn it off for all apps or uncheck just the apps you don't want to have access to location services.