Skip to content

Commit 0c69286

Browse files
committed
document macOS 14.4+ not working
1 parent e87f811 commit 0c69286

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ python -m mozloc.signal
4747

4848
### macOS
4949

50+
Note: macOS 14.4+ no longer works as "airport" has been removed.
51+
If someone has time to implement, perhaps starting with example
52+
[CoreLocation](./macos_corelocation.py)
53+
code, we would welcome a PR.
54+
5055
On macOS, much more accurate results come by running as root by using sudo.
5156
This is because "airport" only emits BSSID if running with sudo.
5257

macos_corelocation.py

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# /usr/bin/env python3
2+
"""
3+
pip install pyobjc
4+
5+
from https://forums.developer.apple.com/forums/thread/748161?answerId=782574022#782574022
6+
"""
7+
8+
import objc
9+
import CoreLocation
10+
11+
location_manager = CoreLocation.CLLocationManager.alloc().init()
12+
location_manager.requestWhenInUseAuthorization()
13+
14+
15+
bundle_path = "/System/Library/Frameworks/CoreWLAN.framework"
16+
17+
objc.loadBundle("CoreWLAN", bundle_path=bundle_path, module_globals=globals())
18+
19+
# https://developer.apple.com/documentation/corewlan/cwinterface
20+
iface = CoreLocation.CWInterface.interface()
21+
22+
print(iface.interfaceName())
23+
print(iface.ssid())
24+
25+
networks, error = iface.scanForNetworksWithSSID_error_(None, None)
26+
27+
for network in networks:
28+
print(network.ssid())

src/mozloc/airport.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
""" MacOS airport functions """
1+
""" MacOS airport functions
2+
3+
Airport was removed from macOS 14.4+, so these functions no longer are relevant.
4+
"""
25

36
from __future__ import annotations
47
import typing as T

0 commit comments

Comments
 (0)