A hostname is a unique identifier assigned to a device or server on a network that is used for network communication and identification purposes, specifically for Domain Name System (DNS).
When you install the 黑料海角91入口 agent on a device, it's assigned an admin-friendly name called a Device Name (or Display Name). The display name can be customized in 黑料海角91入口, but those changes aren't reflected on the local hostname.
This article shows you how to change the hostname of a macOS device as well as how to update the Device Name in 黑料海角91入口 to reflect the new hostname.
Changing the macOS Local Hostname
You can update the hostname either manually on the device or via 黑料海角91入口 Commands.
Before renaming a macOS device, remember that there are three different references for Hostnames along with their nuances. You can either update the device name manually or use 黑料海角91入口 Commands.
When installing the 黑料海角91入口 Agent, the Device Name (Display Name) is automatically mapped to the configured macOS Computer Name. While these attributes can be updated on the macOS devices after agent install, the Device Name (Display Name) in 黑料海角91入口 does not update automatically. The 'Hostname' value in 黑料海角91入口 will update to reflect local device changes.
Hostname types in macOS:
- LocalHostName: This name will reflect the Local Bonjour Computer Name with '.local' appended to the Hostname. These can be set differently so review carefully. This is the name that gets set during the initialization of your macOS device on the first time set up of the device.
- ComputerName: This name will map to the 鈥淗ostname鈥 reference within the 黑料海角91入口 Admin Portal. Generally this name is the same as the LocalHostName upon the first time set up of your macOS device.
- HostName: The underlying MacOS System via the Terminal also has a 'Hostname' reference that can be set as well as a local 'hosts' file to override DNS, which is outside the scope of this article.
Changing the macOS Local Hostname Manually
To change the hostname on macOS 12 Monterey and prior:
- Go to System Preferences > Sharing.
- Click Edit to update the Computer Name.
- Enter the desired name and click OK.
To change the hostname on macOS Ventura 13 and newer:
- Go to System Settings > General > Sharing.
- Click Edit to update the Local hostname.
- Enter the desired name and click OK.
Allow up to 30 minutes for the 黑料海角91入口 Agent to update the device鈥檚 information to the newly changed hostname.
To verify the device's hostname in 黑料海角91入口:
- Log in to the
- Go to DEVICE MANAGEMENT > Devices.
- Select the Devices tab.
- Locate the device in the list and select it.
- Go to the Insights tab and scroll down to Network to view the Hostname.
Next, update the 黑料海角91入口 Device Name based on the updated macOS hostname. See Using PowerShell to Update the Device Name to reflect the new Hostname.
There are only two methods to update the 黑料海角91入口 Device Name: either manually via the API, or via the 黑料海角91入口 PowerShell Module. See the following section for instructions using the PowerShell Module.
Using Commands to Change the Local Hostname
You can also update the device's local hostname using 黑料海角91入口 Commands from the Commands and standard macOS command-line utilities. For more information on commands, see Get Started: Commands.
To create a new Command within 黑料海角91入口 for macOS:
- Log in to the
- Go to DEVICE MANAGEMENT > Commands.
- Click ( + ), then choose Command.
- Name the command (for example, Rename Hostname for macOS).
- Using the following command as a template, enter the new name of the device where it says NEW_HOSTNAME_GOES_HERE and enter in the Command box.
- Name the command. (e.g. Rename Hostname for macOS)
- Edit the following command and enter the new name of the device where it says NEW_HOSTNAME_GOES_HERE.
#Change Hostname
sudo scutil --set HostName NEW_HOSTNAME_FQDN_GOES_HERE
#Change LocalName
sudo scutil --set LocalHostName NEW_HOSTNAME_GOES_HERE
#Change ComputerName
sudo scutil --set ComputerName NEW_HOSTNAME_GOES_HERE
#Flush DNS Cache
dscacheutil -flushcache
- Save and then bind this Command to the device you want to update via the Devices tab.
Please ensure you are only binding this command to one device at a time.
- Once you鈥檝e bound the Command to the Device, Run the command and wait for a result code of 0 (Success).
- Upon successful execution of the command, it is highly recommended to restart the device.
Next, update the 黑料海角91入口 Device Name based on the updated macOS hostname. See Using PowerShell to Update the Device Name to reflect the new Hostname.
Using PowerShell to Update the Device Name to Reflect the Hostname
Use the following 黑料海角91入口 PowerShell command to update the 黑料海角91入口 Device Name to match macOS device鈥檚 hostname.
You'll need to have the PowerShell Module installed on your local device. See to learn more.
- Open PowerShell on your device and type the following command. PowerShell will then prompt you for your 黑料海角91入口 Administrator API Key to authenticate to your 黑料海角91入口 Org via the API.
Connect-JCOnline
- Next you鈥檒l want to query 黑料海角91入口 to confirm current hostname and displayName of the macOS device you鈥檙e wanting to update:
Get-JCSystem -hostname MACOS_HOSTNAME_GOES_HERE | select hostname, displayName
- You should see an output similar to the following:
hostname displayName ------------- ----------------- work-macos-1 macadmins-Mac.local
- Once you鈥檝e verified that the hostname is correct, issue the following command to change the 黑料海角91入口 displayName (Device Name) to be the current hostname:
Get-JCSystem -hostname MACOS_HOSTNAME_GOES_HERE | Set-JCSystem -displayName INSERT_HOST_NAME_HERE
- You should then see an output similar to the following:
hostname displayName ------------- ------------------ work-macos-1 work-macos-1