Jesus Vigo reviews the Terminal commands used to make changes to a Mac's host names.
OS X, like all networked operating systems, have computer names that are used to identify them on a network. However, unlike other operating systems, Macs may have multiple host names that are associated with each device and tied to a specific service or function.
By configuring each of these host names, users can better identify a device in question or set it up with specific names, depending on the type of service being utilized.
HostNames are visible when accessing another Mac through Terminal (via SSH, for example) or when running commands locally. To configure the HostName, enter the following command:
scutil —set HostName "HOSTNAME"
LocalHostNames, though similar to HostNames above, are typically referred to as a Mac's Bonjour name, based on the native auto-configuration protocol built into OS X. In this case, LocalHostNames are displayed with services like Bonjour (or Multicast DNS resolution) or newer services like AirDrop. To configure the LocalHostName, enter the following command:
scutil —set LocalHostName "LOCALHOSTNAME"
ComputerNames are universal to all modern, networked operating systems. OS X is no different in this regard, as the computer name provides a user-friendly naming scheme to identify the device on a network. To configure the ComputerName, enter the following command:
scutil —set ComputerName "COMPUTERNAME"
While the various host names may be set identically to simplify management, the names may also be configured differently from each other without affecting usability of services or accessibility to each device.
In fact, it's not uncommon for Macs bound to Active Directory services to hiccup from time to time with respect to DNS resolution. Manually setting the HostNames has been found to alleviate IP-to-Name resolution when HostNames are set to the .local suffix as opposed to a single or multiple label domain extension.
- Pro tip: 5 more commands Mac admins should know
- How to repackage OS X apps with Packages
- ZDNet: Useful command line tips for programmers and Mac managers
- CNET: How to look up Terminal commands for OS X