Mac OS X 10.3: How to look up ".local" hostnames via both Bonjour and standard DNS

The Multicast DNS feature of Bonjour technology allows devices on a local network to connect to each other by name without a separate DNS server. See this article for more details. By default, any hostname ending in .local is treated as a Bonjour host rather than by querying the DNS server entries in Network preferences.

Though the .local domain is not defined as a valid top-level domain on the Internet, some private networks have DNS servers that assign hostnames in the .local domain. By default Mac OS X does not use the DNS server to resolve these names. This may result in unexpected failures to connect to .local hostnames defined by your server. If .local names are assigned by a DNS server on your network, use the solution below to configure Mac OS X 10.3 to look up .local names in both ways.

This article has been archived and is no longer updated by Apple.

Create and run the following script. To create the script, execute each of these commands in Terminal (/Applications/Utilities/). Each command is preceded by the dollar sign ($), which represents the Terminal prompt. You must be logged with an administrator account to perform these steps. After the first command (sudo), you will be prompted to enter your administrator password. After typing each command, press Return to execute it. After entering the "cat" command, you will not see a prompt ($) for the next four lines, though you must still press Return after each. For the line that says "[Control-D]", press Control-D.

The commands:

$ sudo su
$ cd /usr/sbin
$ cat > EnableUnicastDotLocal
echo domain local > /etc/resolver/local.1
grep -v domain /etc/resolv.conf | grep -v search >> /etc/resolver/local.1
echo search_order 2 >> /etc/resolver/local.1
$ chmod +x EnableUnicastDotLocal
$ exit

These steps create an executable shell script named "EnableUnicastDotLocal" that will create and populate the necessary configuration files to enable dual lookups of .local hostnames.

To run the script, execute this command:

$ sudo /usr/sbin/EnableUnicastDotLocal

Important: The address of the DNS server configured by this script for .local name lookups will not change automatically if your default DNS server address changes. (Your DNS server address may change if you change network locations, if a change is made by your DHCP server administrator, or if you change it manually in Network preferences.) To change the DNS server used for lookups in the .local domain, you must run this script again. To disable unicast DNS lookups entirely after running this script, delete the file /etc/resolver/local.1.

Note: For the Active Directory plug-in to work with .local domains, you must update to Mac OS X 10.3.3 or later.

Last Modified: