File tree 3 files changed +37
-1
lines changed
3 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,11 @@ python -m mozloc.signal
47
47
48
48
### macOS
49
49
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
+
50
55
On macOS, much more accurate results come by running as root by using sudo.
51
56
This is because "airport" only emits BSSID if running with sudo.
52
57
Original file line number Diff line number Diff line change
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 ())
Original file line number Diff line number Diff line change 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
+ """
2
5
3
6
from __future__ import annotations
4
7
import typing as T
You can’t perform that action at this time.
0 commit comments