Hi I'm new to osx and trying to resolve the netbios name of a windows machine. When I try to ping it I get the error cannot resolve hostname. When I use the command smbutil lookup %hostname% it will resolve.

When I ping the ip directly it works fine and this was working on a previous mac which I had to return and replace with my new one. I am able to resolve it from another windows machine on my network.

Essentially I just want to be able to ping my windows machine. Any help would be greatly appreciated.

1 Answer 1


As you mentioned, smbutil lookup will resolve the name to an IP address:

$ smbutil lookup qx-2000
Got response from
IP address of qx-2000:

We can extract the IP address from this output:

$ smbutil lookup qx-2000 2>&1 | tail -n 1 | cut -d : -f 2

Then we can use that in our argument to ping:

$ ping $(smbutil lookup qx-2000 2>&1 | tail -n 1 | cut -d : -f 2)
PING ( 56 data bytes
64 bytes from icmp_seq=0 ttl=128 time=4.823 ms
64 bytes from icmp_seq=1 ttl=128 time=7.373 ms
64 bytes from icmp_seq=2 ttl=128 time=4.820 ms

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .