Skip to content

libardoram/macnetmonitor

Repository files navigation

macOS Network Monitor

A Terminal User Interface (TUI) application for monitoring network interfaces and process connections on macOS.

Features

  • Real-time Network Statistics: View IP addresses and bandwidth usage with braille graphs
  • Bandwidth Formatting: Automatic formatting in B, KB, MB, or GB for easy reading
  • Process Monitoring: List unique process names with their connection counts
  • Connection Details: Select a process to view all its network connections (protocol, addresses, ports, status)
  • Auto-refresh: Data updates every 3 seconds automatically
  • Professional UI: Clean, organized interface with rounded borders and color-coded graphs

Requirements

  • macOS
  • Python 3.12+

Installation

Option 1: Homebrew (Recommended)

brew tap libardoram/tools
brew install macnetmonitor

Option 2: Using uv

uv tool install git+https://github.com/libardoram/macnetmonitor.git

Option 3: Using pipx

pipx install git+https://github.com/libardoram/macnetmonitor.git

Option 4: Using pip

pip install git+https://github.com/libardoram/macnetmonitor.git

Option 5: Development Installation

git clone https://github.com/libardoram/macnetmonitor.git
cd macnetmonitor
uv sync
uv run python main.py

Usage

# Run the application
netw

# To view process connections (requires elevated privileges)
sudo netw

Keyboard Shortcuts

  • q - Quit the application
  • r - Manually refresh data
  • s - Toggle sort (by connections or name)
  • ↑/↓ - Navigate process list

Update

# If installed with Homebrew
brew update
brew upgrade macnetmonitor

# If installed with uv
uv tool upgrade netw

# If installed with pipx
pipx upgrade netw

# If installed with pip
pip install --upgrade git+https://github.com/libardoram/macnetmonitor.git

Uninstall

# If installed with Homebrew
brew uninstall macnetmonitor

# If installed with uv
uv tool uninstall netw

# If installed with pipx
pipx uninstall netw

# If installed with pip
pip uninstall netw

Project Structure

macnetmonitor/
├── main.py                 # Entry point
├── src/
│   ├── app.py             # Main application class
│   ├── models/            # Data models
│   │   ├── connection.py      # Connection data model
│   │   ├── network_stats.py   # Network statistics model
│   │   └── process_info.py    # Process information model
│   ├── network/           # Network data collection
│   │   └── collector.py       # NetworkCollector class
│   └── ui/                # UI widgets
│       ├── braille_graph.py       # Multi-line braille graph renderer
│       ├── connection_details.py  # Connection details table
│       ├── network_stats.py       # Network stats display
│       └── process_list.py        # Process list table
├── pyproject.toml         # Project configuration
└── README.md             # This file

Platform Notes

  • macOS specific: Uses psutil's macOS-specific network interfaces
  • Permissions: psutil.net_connections() requires sudo on macOS for full process information
  • Address families: Supports IPv4 (AF_INET=2) and IPv6 (AF_INET6=10)

Development

Running from Source

git clone https://github.com/libardoram/macnetmonitor.git
cd macnetmonitor
uv sync
uv run python main.py

Code Style

  • Follow PEP 8
  • Use type hints (Python 3.12+ with from __future__ import annotations)
  • Modern type syntax: list[str] instead of List[str], | instead of Union

License

MIT License - see LICENSE file for details

Author

Libardo Ramirez Tirado (libar@mac.com)

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published