How to quickly target shared computers by name in OS X

NetworkIconXEven though in most cases Apple’s Bonjour networking technology allows your Mac to discover relevant services that are broadcast by nearby systems (e.g., shared systems showing in the Finder sidebar), there are times when you may need to enter computer names manually to connect. In these cases, you will have to specify the full name of the system you are targeting, including its domain. For Mac systems, this means append the “.local” suffix to a computer name in order to target it on the local network. However, there is a quick way to avoid having to do this.

If you have a Mac on your LAN called “My iMac” and need to specify its name (such as on the command line, in a Web browser, or in the Finder’s Connect To window), then you may need to type “my-imac.local” as the address for the system. This is because Apple’s Bonjour networking defines the “.local” name as the top level of the local network. By just entering “my-imac”, your Mac will wonder where to search for this computer, so by specifying .local you are telling it to search the local network domain.

This is similar to if you were accessing a server on the internet, where the “.domain.com” specifies the top level as “com” and the “domain” as the network on which your target computer (likely “www” or “ftp”) is residing. This is a very basic look at DNS structures and how hostnames are resolved, but does essentially outline that accessing a computer system for the most part boils down to specifying its name and domain, which are usually separated by a dot:

NAME.DOMAIN

For this approach, the DOMAIN can be anything including “apple.com,” “macissues.com,” or “12345.members.btmm.icloud.com” (when accessing Back to My Mac iCloud services for the fictitious account number 12345). If you were to access the server “www” on the Apple domain, you would enter “www.apple.com,” and similarly if you were to access your home computer called “my-imac” on the “Back to My Mac” domain, you would enter “my-imac.12345.members.btmm.icloud.com” if your iCloud account was “12345” (see here for how to find your iCloud account number)

This is the generally accepted practice for targeting a computer in a given domain; however, in OS X you can provide a shortcut by way of a “search domain,” to have your system prioritize locating a computer on a specified domain. For instance, with “apple.com” configured as a search domain, you can simply type “www” in your Web browser and this will be resolved first using the prioritized search domain on your Mac. In this case, your Mac will find “www” on the “apple.com” domain and your Web browser will resolve to “www.apple.com” as the address.

This ability goes for all domains, including the local bonjour domain, so if you regularly access systems on your LAN by name and wish to avoid typing “.local” all the time, then you can do so by specifying “local” as a search domain.

  1. Go to the Networking system preferences
  2. Select your active networking device (at the top of the list, in green)
  3. Click the Advanced button
  4. Click the DNS tab
  5. Click the plus button under the search domains list
  6. Add the domain part of your desired computer name

As a start, just add “local” to this list, and when saved you will now be able to specify a LAN system by its name only. You can configure additional domains as you see fit, such as “12345.members.btmm.icloud.com” so you then only need to enter your Mac’s name if you want to access it remotely through a non-autodiscovery protocol like SSH. If you make any mistakes and cannot access services for some reason after making these changes, then simply return to this list and remove the domains you added.

Search Domain configuration in OS X

Adding domains to this list will allow you to specify computers and services on the domain by name only, instead of having to include the domain name in your URLs.

Note that search domain configuration is done on a per-adaptor basis, meaning that it has to be done for both Wi-Fi and Ethernet separately. If you have one domain configured on your Wi-Fi adapter, but not on your Ethernet adapter, then if you switch to using Ethernet for connectivity you will need to enter both the computer and domain name. Therefore, consider configuring all network adapters similarly if they have potential to be used on a given network. You can also create new network locations (in the Locations menu at the top of the Network system preferences) to hold different collections of active adapters and configurations for these adapters, based on different network needs (ie, a work network vs a home network). You can access these different locations quickly in the Locations submenu of the Apple menu.

Also note that while this name resolution approach works as I outlined for the most part, some more modern networking protocols may handle resolution and searches differently. For instance, the SMB3 file sharing protocol used by default in more current versions of OS X will search along the local domain regardless of whether “.local” is specified, whereas Apple’s older AFP file sharing protocol does not do this. Therefore, if you use AFP you will see a difference by specifying “.local” as a search domain, whereas with SMB you will not.

4 thoughts on “How to quickly target shared computers by name in OS X

  1. msadesign

    uh-oh.

    I followed the directions. But one remote running ElCap and without the DNS change reports ‘unable to resolve remote-220.local:5900’; this computer was previously reachable. Doing something wrong? And that ‘remote-220’ business is new.

    I attempted to reach this remote using the very handy ScreenSharingMenulet; perhaps that’s the issue.

Comments are closed.