--- id: getmac version: "0.9.5" license: MIT license_treatment: permissive maintenance: active --- # getmac — Get MAC addresses of remote hosts and local interfaces License: permissive · Maintenance: active · Downloads: 385.8K/mo ## What it is and what it does getmac is a pure-Python library that retrieves MAC (Media Access Control) addresses from local network interfaces and remote hosts on the same LAN. It provides a single function, `get_mac_address()`, that accepts either an interface name, IPv4/IPv6 address, or hostname and returns the corresponding MAC address. The package works across Windows, macOS, Linux, BSD, and other POSIX systems without requiring compiled C extensions. The library handles remote host lookups by querying the system's ARP (Address Resolution Protocol) or NDP (Neighbor Discovery Protocol) table. For hosts not yet in the table, it can optionally send a UDP packet to populate the table first. It also offers a command-line tool for one-off lookups and supports Python 2.7 and 3.4 through 3.11, making it suitable for legacy and modern codebases alike. Use it for: - Identify which physical network interface a service is bound to by retrieving its MAC address for logging or diagnostics. - Resolve a remote host's MAC address on the LAN for network inventory, device discovery, or ARP spoofing detection. - Build a cross-platform network diagnostic tool that needs MAC addresses without adding C-extension dependencies. - Populate a local device database by querying MAC addresses of known hosts on a corporate network. - Implement network-based device authentication or access control that keys off MAC addresses. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Retrieves MAC addresses of local network interfaces and remote hosts on the LAN via a single pure-Python function, with no compiled dependencies. Yes. getmac is lightweight, dependency-free, actively maintained, and covers a genuine need for cross-platform MAC address lookup without C extensions. It is well-suited for network diagnostics, device discovery, and inventory tasks. The trade-off is that it relies on ARP/NDP tables and may be slower than C-based alternatives like psutil for high-volume queries, but for typical use cases the simplicity and portability outweigh that cost. ## Install pip install getmac uv add getmac poetry add getmac ## Installing getmac Before you install: Low friction: pure-Python wheel with zero runtime dependencies and a small footprint. Actively maintained as of August 2026 with recent commits; suitable for production use. License in practice: MIT license (permissive) places no restrictions on use, modification, or distribution in proprietary or open-source projects. Quickstart: pip install getmac from getmac import get_mac_address # Get MAC of a local interface eth_mac = get_mac_address(interface="eth0") # Get MAC of a remote host by IP ip_mac = get_mac_address(ip="192.168.0.1") Remote host MAC lookup requires the ARP/NDP table to be populated; by default getmac sends a UDP packet to the target (port 55555) to trigger this, which can be disabled with network_request=False. Verify before relying: - Relative performance compared to alternatives like psutil or netifaces in typical workloads - Success rate of MAC resolution across different network topologies and configurations - Whether Python 3.10+ support is tested in CI or only claimed to work ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 385.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags get mac address network interface, mac address lookup remote host, layer 2 address resolution, arp table mac address, pure python mac address, cross-platform mac address, network interface mac address, network-diagnostics, mac-address, cross-platform [View on SkillFed](https://skillfed.io/packages/getmac) · [View on PyPI](https://pypi.org/project/getmac/)