Resolve internet address (IP) as running apps see them currently (vs. external name server) Sometimes, I need to see the actual IPv4 address of web sites I open in Safari.

Now, there are two terminal commands, host and dig, which I could use for that.

But these commands are not always telling my the actual IP address that the Mac apps, such as Safari, use. Examples for when they show a different IP address:


I've added the address to the Mac's /etc/hosts file.
The IP address has recently changed and the Mac apps still use the previous one it has cached.


So, is there a tool that tells me the IP address that's currently known to OS X instead of the address the external name server reports?
It appears I made wrong assumptions about DNS caching. However, I was right on the /etc/hosts file, in that the host command ignores it, while apps running on the Mac do not ignore it by default.

So, I've made a very simple program that uses one of the Mac OS functions to resolve the host name into an IP address. This way, changes to the hosts file will be seen by this program, as they're seen by any other Mac app.

The program, including Xcode project, can be downloaded here.