Modifying search domain settings under OS X

If you would like to be put a system's name in your web browser, e.g., ajax, into your browser's address bar and have the system automatically append a domain name, e.g. example.com, so that the browser attempts to access ajax.example.com, even though you just typed ajax, you can modify the Domain Name System (DNS) search domain settings. To do so on an Apple OS X/macOS system, take the following steps:

Udemy Generic Category (English)120x600





  1. Click on the Apple icon at the top, left-hand side of your screen.
  2. Chose System Preferences then Network

    OS X System Preferences

  3. Select the relevant network service, such as Wi-Fi or Ethernet, then click on the Advanced button.

    System Preferences - Network

  4. Click on DNS.

    System Preferences - Wi-Fi

  5. Click in the Search Domains box and then click on the "+" at the bottom of that box to add a new search domain.
  6. Type the name of the search domain, e.g., example.com.

    System Preferences - Search Domain

  7. Click on OK.

Now if you type a host name, such as ajax or acme, the system should automatically add the example.com domain as a suffix to the domain name. So, if you put http://acme in a web browser's address bar, the browser should attempt to access http://acme.example.com or if you type ping acme in a Terminal window, the system should ping acme.example.com.

You can add multiple domains; domains will be searched in the order you list them with the search starting at the topmost entry and continuing down through the list of domains with the search stopping when a valid name is found.

You can see which domains will be searched from a command-line interface (CLI), e.g., a Terminal window, using the networksetup command networksetup -getsearchdomains network_service, where network_service is one of the available types of network connections, e.g. Wi-Fi, Thunderbolt Ethernet, USB Ethernet, etc., as shown below:

$ networksetup -getsearchdomains wi-fi
example.com
$