How can I scan the local network for connected devices? (Mac OS)

  1. Ping the broadcast address
    (you can find it with ifconfig | grep broadcast)

  2. and then do an arp -a


Where x.x.x is the first three numbers in your ip address.

for ip in $(seq 1 254); do ping -c 1 x.x.x.$ip -o ConnectTimeout=5; [ $? -eq 0 ] && echo "x.x.x.$ip UP" || : ; done

Single Line Answer: http://nmap.org/download.html [Use NMAP] or Angry IP Scanner