A hostname uniquely identifies a device on a network for communication using Domain Name System (DNS). When you install the JumpCloud agent on a device, it sets the JumpCloud Device Name (or display name) to match the macOS Computer Name. This article explains how to change the hostname of a macOS device and update its corresponding Device Name in JumpCloud.
Considerations
- During initial agent installation, the JumpCloud Device Name matches the device's local hostname (macOS Computer Name).
- After initial installation, changes to the local hostname don't automatically update the Device Name in JumpCloud, and vice versa. To ensure they match, you must manually edit the Device Name in the Admin Portal or update it using PowerShell.
- Or you can use a JumpCloud Command to update a device's local hostname and the JumpCloud Device Name simultaneously.
Changing the Local Hostname Manually
You can update a macOS device's local hostname manually on the device or using JumpCloud Commands.
Before changing the hostname, understand the three different hostname types used in macOS and how they relate to JumpCloud:
- LocalHostName: This name reflects the Local Bonjour Computer Name with '.local' appended. It is set during the initial macOS setup.
- ComputerName: This name maps to the 'Hostname' value displayed in the JumpCloud Admin Portal. It is generally the same as the LocalHostName upon the first time setup.
- HostName: The underlying macOS System hostname, adjustable via the Terminal. (A local 'hosts' file to override DNS is outside the scope of this article.)
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 JumpCloud Agent to update the device’s information to the newly changed hostname.
To verify the device's hostname in JumpCloud:
- Log in to the JumpCloud Admin Portal.
- 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.
After changing the hostname locally, you must update the JumpCloud Device Name manually in the Admin Portal or using the PowerShell Module to ensure it matches the new hostname. Jump to Changing the Device Name Manually to Match the Hostname or Changing the Device Name Using PowerShell.
Changing the Device Name to Match the Hostname
After changing the hostname locally, manually update the Device Name in JumpCloud to match it.
To change the Device Name in JumpCloud:
- Log in to the JumpCloud Admin Portal.
- Go to DEVICE MANAGEMENT > Devices.
- Select the Devices tab.
- Locate the device in the list and select it.
- In the top left, click the pencil next to the Device Name to edit.
- Enter the new Device Name based on the updated hostname.
- Click Done.
Changing the Device Name Using PowerShell
If you manually changed the local hostname on the device, use the following JumpCloud PowerShell command to update the Device Name in JumpCloud.
You'll need to have the PowerShell Module installed on your local device. See Install the JumpCloud PowerShell Module to learn more.
- Open PowerShell on your device and enter the following command:
Connect-JCOnline
- Enter your JumpCloud Administrator API Key to authenticate to your org via the API.
- Confirm the current hostname and displayName of the macOS device you're updating:
Get-JCSystem -hostname MACOS_HOSTNAME_GOES_HERE | select hostname, displayName
You'll see an output similar to the following:
hostname displayName
------------- -----------------
work-macos-1 macadmins-Mac.local
- After verifying the hostname, enter the following command to change the displayName (JumpCloud Device Name) to match the hostname:
Get-JCSystem -hostname MACOS_HOSTNAME_GOES_HERE | Set-JCSystem -displayName INSERT_HOST_NAME_HERE
You'll see an output similar to the following:
hostname displayName
------------- -----------------
work-macos-1 work-macos-1
Using Commands to Change the Hostname and Device Name
You can also update a device's local hostname using JumpCloud Commands, which automatically updates the JumpCloud Device Name to match.
See Get Started: Commands to learn more about commands.
To create the Command in JumpCloud:
- Log in to the JumpCloud Admin Portal.
- Go to DEVICE MANAGEMENT > Commands.
- Click ( + ), then choose Command From Template.
- In the Configure New Command from Template aside, go to the macOS tab.
- Search for the following command: Mac - Rename System HostName, LocalHostName and ComputerName from JumpCloud and then click configure.
- (Optional) Enter a custom name for the command (for example Rename Hostname for macOS).
- Under Command* find the API_KEY value and replace "YourReadOnlyAPIKey" with your API key.
- Go to the Devices tab to bind the command to a device, or the Device Groups tab to bind it to a group of devices.
- Click Save and then click Run Now from the Commands page.
- Upon successful execution of the command, a device restart is recommended.