Mac OS X,  Ubuntu,  Unix

Apropos and OS X

The apropos command is used to search for strings in the whatis database.  The whatis database is compiled by the makewhatis command, which searches for names and descriptions of all the man pages from a directory you specify as part of the command (optionally, or just defaults to /usr/share/man) and throws them into the database.  Apropos then searches these strings and lists a short descriptor.  If you’re thinking that I shouldn’t be lazy and I should remember every single command in Mac OS X, well, while I’d love to, but I have to point out that there are a lot of them…  Also, I’ve learned that there are some very cool commands here and there, completely by accident, using the whatis database and any time I think in my head “head, what is a better way to accomplish this task” I prefer to use apropos to see before using a search engine.  

In addition to apropos there is also whatis, which searches the database for complete words rather than strings.  Small differentiation but one nonetheless – I personally prefer apropos to whatis…

I don’t like to complain much, but the whatis database in OS X is just a bit hit or miss.  So count this as an official complaint in this regard.   Just how messy is the whatis room over in the Mac OS X house?  Well, let’s take airport, a command I described yest.  If you do the following command:

apropos airport

you would expect to see the airport command listed since not only is it the title of the command, but also should be in the description one would assume.  But you don’t.  You see the airportd daemon, but not the airport command itself.  The security command, a front end for managing non-system keychains also  doesn’t show with the keychain search string.  Some apple specific commands do have updated whatis entries.  For example, defaults and plistbuddy both show up when you search for plist.

But most importantly, pretty much all the base Unix commands should show up and these represent the lions’ share of the binaries on the system.  So next time you’re trying to figure out how to do something from the command line, check out apropos first!