Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I'm trying to call nmblookup in a Terminal on Lion, but it's not available. How can I lookup NMB hostnames from the Terminal now?

share|improve this question
    
It should be in /usr/bin. At least, it is on my system. If you want to look for something that is not set up in your path, you can cd to the root directory, and type the following command: find . -name "<name>" -print –  Bill Sep 14 '11 at 2:50
    
Just an aside, I am running Lion (10.7.1) and it does not contain this utility. –  cksum Sep 14 '11 at 4:16
    
P.S. An alternative utility is nslookup. –  Bill Sep 14 '11 at 5:52
1  
Really sorry. I was such in a rush that I indicated that I was using Snow Leopard, but I'm using Lion. My apologies. And as cksum said above, I can't find the utility. "bash: /usr/bin/nmblookup: No such file or directory" –  remino Sep 14 '11 at 6:32
    
Well, that explains why you couldn't find it in your path. As I mentioned earlier, I think a viable alternative is nslookup. I believe that this should be included with Lion as it is a standard utility across most platforms. –  Bill Sep 14 '11 at 6:43

5 Answers 5

up vote 5 down vote accepted

On OS X 10.7 (Lion):

smbutil lookup <hostname>

Example:

$ smbutil lookup NAS1
Got response from 10.21.0.133
IP address of NAS1: 10.21.0.133
share|improve this answer
    
You and Matteo provided useful feedback. Thanks a lot for this useful command! –  remino Sep 15 '11 at 8:40
    
This also works on latest OS X Mavericks. Looks like they removed nmblookup but smbutil still works. –  daveangel Mar 29 at 12:43

run the following command:

which nmblookup

It should output the following:

-bash-3.2$ which nmblookup
/usr/bin/nmblookup

This is on 10.6.8

share|improve this answer
    
Note that the which command will only work if the command can be found in the user's $PATH. In this case, it is pretty unusual why /usr/bin has not been added to the user's path. –  Bill Sep 14 '11 at 5:50
    
nmblookuop is no more present on Lion –  Matteo Sep 14 '11 at 15:10
    
Indeed. Looks like its gone in lion as per the answer above –  Digitalchild Sep 15 '11 at 1:36

The nmblookup utility should be in /usr/bin. Check your $PATH to see if it has been included by typing echo $PATH at the system prompt. If it does exist in your path, then you can run the command which nmblookup, as suggested by @Lyken. Otherwise, to find a command that is not located in your path, type the following commands at the system prompt.

cd /
find . -name "<name>" -print

There is also the whereis command, however, this only checks the standard binary directories for the specified program.

The alternative to nmblookup is nslookup. This is also located under /usr/bin.

Note that I am running Snow Leopard 10.6.8.

share|improve this answer
    
No need to search for it: is no more there on Lion –  Matteo Sep 14 '11 at 15:12
    
Point taken. I wrote this before the question was changed from Snow Leopard to Lion. What seemed unusual at the time was why /usr/bin wouldn't be in the user's $PATH. Having seen the responses from other people, it makes more sense now. –  Bill Sep 14 '11 at 23:09

Samba is no more part of OS X: Lion has an own implementation of the protocol. It was dropped because Samba moved to a stricter license (GPLv3) which gives Apple problems with the publication of the software on the App Store.

Edit

Here you can find some more information: http://www.appleinsider.com/articles/11/03/23/inside_mac_os_x_10_7_lion_server_apple_replaces_samba_for_windows_networking_services.html

nmblookup was removed along many other command line tools:

[...]reducing the number of commands and subcommands from over a hundred to just 19[...]

Thanks to cksum for the hint

As Ingmar answers you can use smbutil lookup

share|improve this answer
1  
Absolutely right. Here's more on the subject if you'd like to incorporate it into your answer (it talks of Lion Server, but it should also apple to the consumer version of Lion): appleinsider.com/articles/11/03/23/… –  cksum Sep 14 '11 at 7:07
    
This is good to know. No idea Samba got kicked out of Mac OS X because of licensing issues. –  remino Sep 15 '11 at 8:41
    
@Rémi: not only Samba, gcc too (substituted by LLVM). In principle everything licensed with GPLv3 –  Matteo Sep 15 '11 at 9:26

If you must have nmblookup you may install samba3 via MacPorts and probably brew, I don't use brew so I'm not completely sure.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.