Software

How to change HostNames via Terminal

Jesus Vigo reviews the Terminal commands used to make changes to a Mac's host names.

Change host names via Terminal

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.

HostName

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"

LocalHostName

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"

ComputerName

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.

Also see

About Jesus Vigo

Jesus Vigo is a Network Administrator by day and owner of Mac|Jesus, LLC, specializing in Mac and Windows integration and providing solutions to small- and medium-size businesses. He brings 19 years of experience and multiple certifications from seve...

Editor's Picks

Free Newsletters, In your Inbox