I set up a Raspberry Pi Zero with Raspberry Pi Imager, connected it to Wi-Fi, and then wanted to SSH into it. I had no idea which IP address the router had handed it. The arp command on macOS answered that in one line.
arp maps local IP addresses to MAC addressesarp stands for Address Resolution Protocol. On a local network it maps IP addresses to MAC addresses. On macOS, the arp command prints the ARP cache: the table of local IP addresses your Mac has recently resolved to hardware MAC addresses.
That is enough to find a newly connected device like a Raspberry Pi, and to read the MAC address of the Raspberry Pi at the same time.
arp -a once the Pi is on the networkOnce the Pi had booted and connected to Wi-Fi, I ran this on my Mac:
arp -aThat prints a list of local IP addresses and the MAC addresses your Mac has seen. The output looks something like this:
router.local (192.168.1.1) at 62:87:f0:xx:xx:xx on en0 ifscope [ethernet]
raspberrypi-zero.local (192.168.1.23) at dc:a6:32:xx:xx:xx on en0 ifscope [ethernet]
macbook-pro.local (192.168.1.12) at 3c:52:a1:xx:xx:xx on en0 ifscope [ethernet]In my case, the most useful part was that the Raspberry Pi name showed up in the output. That meant I could look for the hostname I had used during setup and immediately get the IP address I needed for SSH.
If the device name does not show up on your network, look for the new entry that appeared after you powered on the Pi. A Raspberry Pi MAC address is easy to recognize on its own, because the boards ship with prefixes registered to the Raspberry Pi Foundation: b8:27:eb, dc:a6:32, d8:3a:dd, and 2c:cf:67 are the common ones. An entry starting with one of those is almost certainly the Pi. If you already have a shell on the board, ip link show prints the same MAC address from the Pi side.
Once you have the IP address, you can SSH into the Pi with:
ssh <your-username>@<ip-address>With the username and IP address from the output above, that becomes:
ssh [email protected]arp -a reads a cache, not a live network scanarp -a is not a network scanner. It only shows entries your Mac already has in its ARP cache, so a device usually has to have talked on the local network recently to appear there. If the Pi is missing, ping the broadcast address or the router first, then run arp -a again.
Still, for a quick Raspberry Pi setup, it was exactly what I needed. It let me see the IP-to-MAC mappings on my network and use that information to connect to the Pi without guessing or opening my router admin page.
Occasional notes on software, tools, and things I learn. No spam.
Unsubscribe anytime.