View IP Addresses of LAN Devices from Command Line in Mac OS

Nov 3, 2016 - 6 Comments

Find Local Hardware IP Addresses on LAN

If you need to view the IP addresses of other hardware on the same LAN (Local Area Network) as a Mac, the command line arp tool works quite well. You’ll quickly find other devices IP and accompanying MAC addresses, which can make direct network connections easier and be helpful for many other network and troubleshooting purposes.

Find Local Device IP Addresses with arp

To get started, launch the Terminal app from /Applications/Utilities/ (or accessed with Spotlight and Command+Spacebar). The arp tool is uses ARP (Address Resolution Protocol) to display and control network address resolution functions. For the purposes we want to achieve here, the most simple use of arp is with an -a flag attached:

arp -a

This will return devices found on the local network, including other Macs, PCs, routers, iPhones, and iPads, displaying both their LAN IP address as well as their individual MAC address. (For the latter, you can help distinguish hardware by matching them up to the MAC address found in MacOS X or in iOS).

An example of arp -a output looks like this:
% arp -a
? ( at 0:0:ca:1:2:3 on en0 ifscope [ethernet]
? ( at 68:b8:3d:22:1c:42 on en0 ifscope [ethernet]
? ( at b4:12:23:5a:d3:6f on en0 ifscope [ethernet]
? ( at ff:ff:ff:ff:ff:ff on en0 ifscope [ethernet]

If the output doesn’t look up to date, or if it’s missing an IP you believe should be there, ping the broadcast IP (typically the last result of arp -a ending with “.255”), then run arp -a again like so:

Terminal% ping
PING ( 56 data bytes
64 bytes from icmp_seq=0 ttl=64 time=0.079 ms
64 bytes from icmp_seq=0 ttl=64 time=1.922 ms
--- ping statistics ---
2 packets transmitted, 2 packets received, +6 duplicates, 0.0% packet loss
round-trip min/avg/max/stddev = 0.079/39.404/303.510/75.738 ms

Terminal% arp -a
? ( at 0:0:ca:1:2:3 on en0 ifscope [ethernet]
? ( at 68:b8:3d:22:1c:42 on en0 ifscope [ethernet]
? ( at 22:12:bb:a0:3d:fd on en0 ifscope [ethernet]
? ( at b4:12:23:5a:d3:6f on en0 ifscope [ethernet]
? ( at ff:ff:ff:ff:ff:ff on en0 ifscope [ethernet]

Note in this example that is a fresh IP compared to the prior results, as that machine just joined the network.

You can ignore the protocol suggestion at the end of the arp results, in this example despite the devices showing as “ethernet”, they’re actually all on a wireless network with wi-fi on the en0 interface.

Do note that you will not see the Macs own IP address or MAC address in this list. If need be, you can find your own IP address through Terminal, System Preferences, or by using an outside service if you’re looking for the external address.

While arp works well enough for most cases, and it has the advantage of being built into all versions of OS X, it may not be sufficient for everyone. For more advanced users, nmap is an even better option for a network discovery tool, but nmap requires installing either directly, compiling through source, or through something like homebrew.

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

Posted by: Paul Horowitz in Command Line, Mac OS X, Tips & Tricks


» Comments RSS Feed

  1. Jon Ravioli says:

    Great tip.

    You should always ping the network broadcast address and then run arp -a for the most up to date list.

    That is, unless you have already contacted other network machines, then it will be up to date with hardware.

    Every device will show up on the arp list though, not just computers in the networked sense. That means the Windows, Androids, iPhones and iPads too.

  2. junebeetle says:

    Thanks for the very useful tip!

  3. gutgetarnt says:

    This only works to review IPv4 hosts. To view IPv6 LAN hosts, use “ndp -a”.

  4. Jonathan says:

    In what kind of situation would you use this? What would you be trying to find out and why? Thanks.

    • Paul says:

      There are many situations this can be useful, from network discovery to connecting to network resources.

      Personally I use this frequently when I need the IP address of a given network device to connect to, particularly other older Macs that often don’t show up in the Network search but you can connect to reliably with SMB by specifying an IP. Same idea with networking to some Windows machines too.

    • Toby says:

      Another great use of this tip is to find the IP address of an IP camera when first setting it up.

Leave a Reply


Shop for Apple & Mac Deals on

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates