A lightweight macOS menu bar app that shows live network upload and download speeds, built with Swift and SwiftUI.
↓ 1.2 MB/s ↑ 340 KB/s
- Live download and upload speeds in the menu bar, refreshed every 0.5 seconds
- Dynamic units (B/s, KB/s, MB/s, GB/s) based on throughput
- Runs as a pure menu bar agent: no Dock icon, no app switcher entry (
LSUIElement) - Click the menu bar item for a popover with the current rates, a Launch at Login switch and a Quit button
- Tiny footprint: no dependencies, just SwiftUI, Combine and Darwin
- macOS 13.0 (Ventura) or later
- Xcode 15 or later (to build)
git clone https://github.com/fuadkhairi/NetWatcher.git
cd NetWatcher
./scripts/build_app.sh
open build/NetWatcher.appThe script runs xcodebuild on NetWatcher.xcodeproj and puts the Release app in build/NetWatcher.app. It signs ad-hoc by default; to use your own certificate, set SIGN_IDENTITY and TEAM_ID (list identities with security find-identity -v -p codesigning):
SIGN_IDENTITY="Apple Development: Your Name (ID)" TEAM_ID=YOURTEAMID ./scripts/build_app.shNote: The app is not notarized. If macOS blocks it on first launch, right-click the app and choose Open.
You can also open NetWatcher.xcodeproj in Xcode and press Run. The project sets LSUIElement, so there is no Dock icon either way.
- Copy the app to a stable location so the login item doesn't break when you rebuild:
cp -R build/NetWatcher.app /Applications/
- Open it from
/Applications, click the menu bar item, and turn on Launch at Login.
Turn the switch off to stop it starting at login. You can also manage it in System Settings → General → Login Items & Extensions.
If macOS shows an error under the switch, make sure the app is running from /Applications and not from build/. Don't also add it manually in System Settings, or it may start twice.
| Piece | Details |
|---|---|
| Data source | getifaddrs at the AF_LINK layer, reading each interface's byte counters |
| Interface filter | Skips lo0; keeps only interfaces with IFF_UP and IFF_RUNNING |
| Sampling | A timer fires every 0.5s; speed = byte delta ÷ the actual elapsed Date() interval |
| Counter rollover | Darwin's if_data counters are 32-bit and wrap at about 4 GiB. Deltas are computed per interface and widened to UInt64; a counter that goes backwards is treated as a single wrap |
| New interfaces | An interface seen for the first time is skipped for that tick, so it can't cause a false spike |
| UI | SwiftUI MenuBarExtra with the .window style |
Speeds are summed across all active interfaces (Wi-Fi, Ethernet, VPN tunnels and so on). Traffic that crosses both a physical interface and a VPN tunnel may therefore be counted twice.
NetWatcher/
├── NetWatcher.xcodeproj
├── NetWatcher/
│ ├── NetWatcherApp.swift # @main app and popover view
│ ├── NetworkMonitor.swift # interface reader, poller, speed formatter
│ ├── LaunchAtLogin.swift # SMAppService wrapper
│ └── Assets.xcassets # app icon
├── NetWatcherTests/ # unit tests (rollover, formatting)
└── scripts/build_app.sh # Release build into build/NetWatcher.app
LSUIElement (no Dock icon) is set as a build setting in the Xcode project, not in a separate Info.plist.
Licensed under the Apache License 2.0.