brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: networksetup -listallhardwareports tells you which port is en0 on a Mac

macOS
~/tips/tip-macos-networksetup-hardwareports

networksetup -listallhardwareports

Match device names like en0 or en5 to Wi-Fi, Ethernet and Thunderbolt ports.

Terminal tools speak in device names like en0 and en7. System Settings speaks in Wi-Fi and Ethernet. This command translates between the two.

Run it without sudo:

networksetup -listallhardwareports

For every port you get three lines: the hardware port name, the device and its Ethernet (MAC) address. A typical block looks like this:

Hardware Port: Wi-Fi
Device: en0
Ethernet Address: 02:00:00:aa:bb:cc

On a MacBook, en0 is usually Wi-Fi, but don’t count on it on a Mac mini or iMac with a built-in Ethernet port, or once docks and adapters come into play. A USB or Thunderbolt Ethernet adapter gets its own device name, and each new adapter can get a new one.

That’s when this list pays off. A command like ipconfig getifaddr en5 or a firewall rule in a tool needs the right device, and here you can see which one it is. The MAC address is handy too, for a DHCP reservation in your router.

The list shows ports, not whether they’re connected. For the live state of a device, ifconfig en5 tells you if it’s active. And if you plug in a new adapter and it’s missing from the list, the man page has -detectnewhardware, which needs admin rights, so I’d simply try System Settings first.

Further reading: networksetup.8 man page

More macOS tips System Settings > Accessibility > Hover Text > When using the pointer A Smart Folder in Notes collects notes by tag, checklist or date Type # in a Mac note to tag it, then filter by tag in the sidebar tmutil isexcluded ~/Projects/app/node_modules Crop an image in Preview by dragging a frame and clicking Crop All macOS tips (99) All topics

Link