getmac is a cross-platform Python library designed to reliably retrieve the MAC addresses of local network interfaces and remote hosts. The current version is 0.9.5, and it maintains a regular release cadence, providing minor updates with bug fixes and improvements every few months.
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
from getmac import get_mac_address
Demonstrates how to retrieve the local machine's MAC address, and optionally, how to fetch the MAC address for a specific interface or a remote IP.
from getmac import get_mac_address
# Get the MAC address of the first available local interface
mac_address = get_mac_address()
print(f"Local MAC Address: {mac_address}")
# Optionally, get MAC for a specific interface (e.g., 'eth0' or 'en0')
# interface_mac = get_mac_address(interface='eth0')
# if interface_mac:
# print(f"MAC for eth0: {interface_mac}")
# Optionally, get MAC for a remote IP address (requires ARP access)
# remote_ip = '192.168.1.1' # Replace with a reachable IP
# remote_mac = get_mac_address(ip=remote_ip)
# if remote_mac:
# print(f"MAC for {remote_ip}: {remote_mac}")
getmac --version
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.
Agent activity
0 hits · last 30 days
No traffic data recorded yet.