osascript-network
Network inspection via airport, networksetup, ifconfig, and Darwin notifications.
All scripts are pure Python using stdlib + subprocess — no JXA needed.
Scripts
Get current WiFi info — SSID, BSSID, signal (dBm), channel, band, security:
uv run scripts/wifi-info.py
List all network interfaces with IPv4, IPv6, MAC address, and active state:
uv run scripts/network-interfaces.py
Block until the next network change event, then print what changed — --count N to watch N events:
uv run scripts/watch-network.py
uv run scripts/watch-network.py --count 5
Key Tools
| Tool | Path | Purpose |
|---|---|---|
airport |
/System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport |
WiFi details |
networksetup |
/usr/sbin/networksetup |
Interface enumeration |
ifconfig |
/sbin/ifconfig |
IP/MAC per interface |
notifyutil |
/usr/bin/notifyutil |
Darwin notification watcher |
Darwin Network Change Notification
com.apple.system.config.network_change fires when:
- WiFi connects or disconnects
- VPN connects or disconnects
- Ethernet plugged/unplugged
- IP address changes (DHCP renewal)
Reference
- reference/11-notifications.md — Darwin notifications, notifyutil patterns, NSDistributedNotificationCenter