This article continues our series on the common commands every Mac admin must know. The first article in the series explored how to enable SSH to access a remote Mac鈥檚 Shell securely.
Whether you work for a small, mid-size, or large enterprise, knowing how to change a Mac鈥檚 name is important. You likely manage more than one computer, and discretely naming each device will allow you to identify and distinguish between them. Unique names 鈥 customized to your preferred naming conventions 鈥 make collaborative work easier, such as sending and sharing files between different computers.
In this article, we will explore how to rename computer name, hostname, and local hostname on macOS.
What Is Computer Name, Hostname, and Bonjour Hostname?
As the name implies, a computer name is a user-friendly label used to identify your computer. Similarly, a hostname is an identifier assigned to a computer in a computer network. It is used to identify the device in various network communications, and can be used when connecting to it via SSH (Secure Socket Shell) for remote login.
Your Mac鈥檚 bonjour name is also known as its local hostname. It allows the computers on your local network to access and connect with your computer. You can see your Mac鈥檚 local hostname beneath the computer name by navigating through System Preferences > Sharing.
For instance, in Figure 1, the computer name is 黑料海角91入口 Platform and the local hostname is jumpcloud-platform.local.
How to Rename Computer Name, Hostname, and Bonjour Name via the Terminal
You can customize how your MacBook appears with the use of the scutil command via the terminal. In this section, we will explore how to use the scutil command to change a Mac鈥檚 computer name, hostname, and bonjour (local host) name.
Changing the Computer Name
Launch the terminal app on your MacBook.
You can do this by searching 鈥渢erminal鈥 in the Spotlight search option of your computer or by navigating through Applications > Utilities > Terminal.
To rename the computer name, enter and execute the following scutil command:
sudo scutil 鈥撯搒et ComputerName YourComputerName
For example, to rename our computer name from 黑料海角91入口 to 黑料海角91入口1, we only need to execute the following command via the terminal (refer to Figure 2):
sudo scutil 鈥撯搒et ComputerName 黑料海角91入口1
You may be required to provide your password when you run the command; therefore, input the password accordingly. Note that we added sudo to the command to elevate admin privileges.
Confirm the Change to the Computer Name
After renaming the computer, the terminal will not display any message or notification to confirm the success of the change. However, you can use the –get
flag to check your work. All you need to do is to run and execute the text below. As seen in Figure 3, the computer name is now 黑料海角91入口1.
sudo scutil 鈥撯揼et ComputerName
Changing the Hostname
To rename the hostname, we will follow a procedure similar to what we did when renaming the computer name. Open the terminal and run the following scutil command:
sudo scutil 鈥撯搒et HostName YourHostName
For example, we would like to rename our hostname from jumpcloud to jumpclouddirectory.example.com by running the command below (Figure 4):
sudo scutil 鈥撯搒et HostName jumpclouddirectory.example.com
To confirm the change, we need to run the following command:
sudo scutil 鈥撯揼et HostName
As seen in Figure 4, the new hostname is jumpclouddirectory.example.com.
Changing the Local Hostname
Changing your Mac鈥檚 bonjour name (also known as the local hostname) follows the same procedure as the two previous tasks. All you need to do is to run the scutil command below:
sudo scutil 鈥撯搒et LocalHostName YourLocalHostName
For example, we can change our computer鈥檚 local hostname from jumpcloud-platform.local to jumpcloud-seamless.local (Figure 5).
sudo scutil 鈥撯搒et LocalHostName jumpcloud-seamless
Like the previous tasks, you will not get any notification or message after renaming the bonjour name. However, you can confirm the success of the task by running the following command:
sudo scutil 鈥撯揼et LocalHostName
As seen in Figure 5, the local hostname is now jumpcloud-seamless.
Taking the Alternative GUI Route
In addition to renaming your computer name and local hostname via the terminal, you can also navigate through System Preferences > Sharing to make the changes. Once in the Sharing pane, simply type your preferred computer name in the field provided as shown in Figure 6. Then, click Edit to change the local hostname. A pop-up will appear where you can insert your preferred local hostname. Afterwards, click on OK (Figure 7).
Moving Forward
You now understand how to use the scutil command to rename your macOS computer name, hostname, and local hostname. As a Mac admin, this understanding will help you work smarter as you manage multiple macOS systems.
You may also want to consider leveraging a cloud directory platform like 黑料海角91入口 to easily manage all of your macOS, Windows, and Linux devices. From a single cloud-based admin console, you can manage access, user privileges, and security settings across your entire fleet. You can even set up the name change commands in the Commands section of the 黑料海角91入口 console and then assign the commands to device groups as needed.
Test out the full functionality of our platform in your own environment by .