With BIND (named) enabled on an OS-X Lion iMac, DNS lookups look at /etc/hosts only after checking with BIND and hence I can't override addresses using the hosts file. BIND does not even seem to access /etc/hosts (or /etc/resolv.conf) as far as I can see (using dtruss and from the sandbox log) so it must be some other OS-X DNS mechanism that does that.

Can I somehow tell BIND to consult /etc/hosts?

Thanks for your time and help


ps. Using BIND 9.7.3-P3 built with '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-dependency-tracking' '--prefix=/usr' '--sysconfdir=/private/etc' '--localstatedir=/private/var' '--enable-atomic=no' '--with-openssl=yes' '--with-gssapi=yes' '--enable-symtable=none' 'CFLAGS=-arch x86_64 -arch i386 -g -Os -pipe -gdwarf-2 -D__APPLE_USE_RFC_2292' 'LDFLAGS=-arch x86_64 -arch i386 ' 'CXXFLAGS=-arch x86_64 -arch i386 -g -Os -pipe '

  • 4
    I've never seen bind query /etc/hosts. Why are you expecting it to? Jan 24, 2012 at 0:03
  • I didn't know any better ;-) Jan 24, 2012 at 2:24

2 Answers 2


BIND does not consult /etc/hosts. In Unix/Linux this is handled by the name service switch (nsswitch), which typically consults hosts and then DNS.

In Mac OS X this is handled by Directory Services.

You may want to flush the DS cache if you're having issues. Check the man pages for DirectoryService and dscacheutil.


Actually, it sounds like what you're actually asking is how to get Lion's resolver to query /etc/hosts first, and then whatever nameserver it has configured. You may find this to be useful:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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