Skip to content

SNGWN/Network-Speed

Repository files navigation

Network Speed Monitor

A lightweight, real-time network speed monitoring application for macOS. Displays upload and download speeds directly in the menu bar with minimal system overhead and zero configuration required.

Swift macOS License


Overview

Network Speed Monitor is a macOS menu bar utility that continuously monitors your network bandwidth. It shows real-time upload and download speeds in a clean, non-intrusive format. Launch it once and it automatically starts on every login—no setup required.

Key Highlights

  • 📊 Real-time Monitoring – Updates every second
  • 🎯 Menu Bar Display – Compact format: ↓ xx.x MB/s | ↑ xx.x MB/s
  • Ultra-Lightweight – ~20-30 MB memory, <1% CPU usage
  • 🚀 Auto-Start on Login – Launches automatically at boot
  • 🔧 Zero Configuration – Works out of the box
  • 🛡️ Memory Safe – Pure Swift, no unsafe code

Requirements

Requirement Details
macOS Version 11.0 (Big Sur) or later
Architecture Intel or Apple Silicon (M1+)
Build Tools Swift 5.5+ (only needed for building)

Installation

Option 1: Download Pre-Built App (Easiest)

Download the latest NetworkMonitor.app.zip from the Releases page.

# Extract and launch
unzip NetworkMonitor.app.zip
open NetworkMonitor.app

Option 2: Build from Source

# Clone the repository
git clone https://github.com/SNGWN/Network-Speed.git
cd Network-Speed

# Build release version
swift build -c release

# Create .app bundle
bash create_app_bundle.sh
open NetworkMonitor.app

Option 3: Build and Bundle Automatically

# One-line build + bundle creation
bash create_app_bundle.sh

This generates:

  • NetworkMonitor.app – Ready to launch
  • NetworkMonitor.app.zip – Ready to distribute

Usage

  1. Launch the app (once, or it will auto-start on next login)
  2. Monitor network speed in the menu bar (top-right corner)
  3. Quit by right-clicking the menu bar icon and selecting "Quit" (or press Cmd+Q)

Menu Bar Display Format

↓ 125.4 MB/s | ↑ 45.2 MB/s
  • = Download speed
  • = Upload speed

Auto-Start on Login

The app automatically configures auto-start on first launch.

LaunchAgent Location:

~/Library/LaunchAgents/com.networkmonitor.autostart.plist

To disable auto-start:

launchctl unload ~/Library/LaunchAgents/com.networkmonitor.autostart.plist

To re-enable auto-start:

launchctl load ~/Library/LaunchAgents/com.networkmonitor.autostart.plist

To verify auto-start is active:

launchctl list | grep networkmonitor

Architecture

NetworkUsageMonitor/
├── NetworkUsageMonitorApp.swift    # App entry point, AppDelegate
├── Managers/
│   ├── NetworkMonitor.swift        # Executes nettop and parses output
│   └── NetworkViewModel.swift      # Observable state, timer management
├── Models/
│   └── NetworkSpeed.swift          # Speed data structure
├── Views/
│   └── MenuBarView.swift           # Menu bar UI
└── Utilities/
    ├── FormatUtility.swift         # Speed formatting (e.g., "125.4 MB/s")
    └── NetworkMonitorConstants.swift # Configuration values

How It Works

  1. Data Collection – Executes macOS nettop utility every second
  2. Parsing – Extracts upload/download bytes from nettop output
  3. Calculation – Computes speed in MB/s or KB/s based on throughput
  4. Display – Updates menu bar with formatted speed string
  5. Cleanup – Properly manages process lifecycle and memory

Performance Metrics

Metric Value
Memory Usage 20-30 MB
CPU Usage <1% (average)
Startup Time <100 ms
Update Latency <100 ms
Measurement Accuracy ±1-2%

Building & Development

Development Build

swift build
.build/debug/NetworkUsageMonitor

Release Build

swift build -c release
.build/release/NetworkUsageMonitor

Create App Bundle Manually

# Create directory structure
mkdir -p NetworkMonitor.app/Contents/MacOS

# Copy compiled binary
cp .build/release/NetworkUsageMonitor NetworkMonitor.app/Contents/MacOS/NetworkMonitor

# Make executable
chmod +x NetworkMonitor.app/Contents/MacOS/NetworkMonitor

Troubleshooting

Issue: App doesn't auto-start on login

Solution:

  1. Check if LaunchAgent exists: ls ~/Library/LaunchAgents/com.networkmonitor.autostart.plist
  2. If missing, launch the app once to create it
  3. Verify: launchctl list | grep networkmonitor

Issue: Speed displays "-- B/s"

Cause: Normal during startup or network interruptions
Solution:

  • Wait a few seconds for the app to initialize
  • Check internet connectivity
  • App will automatically recover

Issue: High CPU usage

Cause: Can be normal during first 10 seconds of operation
Solution:

  • Wait 10-15 seconds after startup
  • If persists, restart the app
  • Report issue if usage stays above 2%

Issue: App won't open (security warning)

Solution:

  1. Right-click the app
  2. Select "Open" (not double-click)
  3. Click "Open" in the security dialog

Project Structure

Network-Speed/
├── Package.swift                 # Swift package manifest
├── Sources/
│   └── NetworkUsageMonitor/      # Main source code
├── Tests/
│   └── NetworkUsageMonitorTests/ # Test suite
├── create_app_bundle.sh          # Bash script to create .app bundle
├── Info.plist                    # App metadata
├── README.md                     # This file
└── LICENSE                       # MIT License

Dependencies

Component Purpose Source
Foundation Core library Swift stdlib
SwiftUI User interface Apple
AppKit Menu bar integration Apple
Combine Reactive programming Apple
nettop Network data collection macOS built-in

No external package dependencies – uses only Apple frameworks.


Limitations

  • Real-time only – No historical graphs or data storage
  • System-wide speeds – No per-app breakdown (intentional design choice)
  • macOS only – Requires macOS 11.0 or later
  • No configuration – Settings are fixed for simplicity

Code Quality

  • Language: 100% Swift
  • Lines of Code: ~280 (core functionality)
  • Memory Safety: No unsafe code blocks
  • Error Handling: Comprehensive try-catch patterns
  • Resource Management: Proper cleanup of nettop process

License

MIT License – See LICENSE for details.

You are free to use, modify, and distribute this software.


Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/your-feature)
  3. Commit your changes (git commit -am 'Add feature')
  4. Push to the branch (git push origin feature/your-feature)
  5. Open a Pull Request

Support & Issues

Found a bug or have a suggestion? Please open an issue with:

  • macOS version (e.g., Sonoma 14.2)
  • Mac hardware (Intel/M1/M2/M3/etc)
  • Steps to reproduce the issue
  • Expected vs actual behavior
  • Log output if available

Status

✅ Production Ready

Tested and verified on:

  • macOS 11 (Big Sur) – Intel
  • macOS 12 (Monterey) – M1
  • macOS 13 (Ventura) – M1/M2
  • macOS 14 (Sonoma) – M1/M2/M3

Made with Swift for performance, reliability, and minimal system overhead.

About

Very Basic Mac OS tool to show Network UP/Down Speed in real time.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors