How to find IP address of my other Mac? I have two Macs on the same network, both plugged into my internet router.  I have screen-sharing set up on one of them, so I can connect to it using command-K in the Finder with a vnc:// URL, and that works great.

My router assigns IP addresses using DHCP, which in general is a good thing, but it means if a machine gets restarted or a DHCP lease gets renewed, I don't know what IP address to connect to (without walking over to the other machine to find out).

Surely my Mac already knows the IP address of my other Mac: in the Finder, I can see my other Mac's name and icon/type in the sidebar!  Unfortunately, Get Info doesn't display the IP address, or anything else useful about it.

How can I find out the IP address of my other Mac, perhaps using Zeroconf/Bonjour?  I'm fine with a command-line solution, if there's a simple one.

EDIT: I'm running Lion, and I think that OS X screen sharing broadcasts a Bonjour service announcement for it, but Lion's connect-to-server dialog box doesn't take advantage of it.  If this is something Mountain Lion does, knowing that would be helpful, too!
Your computers should be accessible as computer-name.local, e.g. Kens-Computer.local or something like that, so depending on what you're trying to do, you might be able to just use that name rather than the IP.

So you can just type vnc://Kens-Computer.local in the 'Connect to' window. You can see the computer's network name if you go to the Sharing preference pane in System Preferences. It's at the top of the page, with a message like "Computers on your local network can access your computer at: Kens-Computer.local"

Make sure you include the ".local" suffix to get the Bonjour IP, otherwise your DNS look-up might auto-append some other hostname suffix (depending on your network/DHCP configuration) or simply fail to find the right host.

If you really want to get the IP though, here's a couple of options:

Bonjour / dns-sd

You can use Bonjour directly via commands like the DNS Service Discovery tool (dns-sd). Try the following in the Terminal application:

% dns-sd -q computer-name
DATE: ---Tue 09 Oct 2012---
18:13:39.209  ...STARTING...
Timestamp     A/R Flags if Name                             T   C Rdata
18:13:39.210  Add     2  4 Computer-Name.local.             1   1 10.1.1.141


The dns-sd tool can do quite a bit, e.g. if you want to list all local VNC services (at least the ones advertised via Bonjour). VNC services are advertised as "_rfb" in mDNS/Bonjour:

% dns-sd -B _rfb local


Ping

Or you can just ping it, which will show the IP in the output (and is just using Bonjour/mDNS to find the IP).

% ping computer-name.local
PING computer-name.local (10.1.1.141): 56 data bytes
64 bytes from 10.1.1.141: icmp_seq=0 ttl=64 time=0.066 ms