If you own a MacBook or iMac, you may have noticed that the default machine names often reflect a serial number or generic “MacBook‑Pro of “user”” label. Changing these identifiers helps make your system easier to recognize on the network, in AirDrop, Terminal, or when you manage multiple machines.
This guide covers the differences between HostName, ComputerName, LocalHostName, and DiskName, shows you the Terminal commands to adjust each, and offers troubleshooting tips to make sure your changes stick.
🔍 Understanding the Name Fields
| Name Type | Where It Appears | Notes |
|---|---|---|
| HostName | The network name your Mac uses on other devices (e.g., via SSH or Terminal) | Often uses DNS‑style naming; appears when you run hostname in Terminal. |
| ComputerName | The name shown in the Sharing panel, AirDrop, Finder sidebar, etc. | More user‑friendly, plain text. |
| LocalHostName | The Bonjour (local network) name, used by services like AirDrop and Home Sharing. | Usually lower‑case, no spaces (converted to e.g., macbook‑pro‑local). |
| DiskName | The volume name of your startup disk (e.g., “Macintosh HD”) | Changing this affects how the disk appears in Finder, Terminal, and when mounted by other systems. |
By default, macOS may set all of these to the same value (for example: John’s MacBook Pro). However, they each serve different roles — and you may want to customize them separately.
🛠 How to Change Name via Terminal
Prerequisite: Open Terminal (Applications → Utilities → Terminal). Many of these commands require sudo permissions, so you will be asked for your administrator password.

You can change the hostname via terminal using two different commands:
1. Option 1 – hostname
This option didn’t work for me as the hostname was getting reset after restart. Am currently on macOS Monterey 12.6.1 although osxdaily article suggests it works after Mavericks update.
sudo hostname -s new_hostname
Verify the change using this command:
hostname
> new_hostname
Note: Until restart this option seems to work
2. Option 2 – HostName, ComputerName, LocalHostName
sudo scutil --set HostName "raptordotin"
Using scutil command we can update ComputerName and LocalHostName as well.
sudo scutil --set ComputerName "raptor's Macbook Pro"
sudo scutil --set LocalHostName "raptordotin-local"
Verify the change using this command:
scutil --get HostName
> raptordotin
scutil --get ComputerName
> raptor's Macbook Pro
scutil --get LocalHostName
> raptordotin-local
Close and open the terminal again to see the change.

3. Disk Name
Finally it would be nice to rename your diskname as well.
Use this diskutil to rename disk name
diskutil rename / raptordotin-SSD
You can achieve the same using “Disk Utility” App as well.
Verify the change using UI:
- Open finder to verify computer name and disk name
- Open Settings -> Systems Preference -> Sharing to verify computer name and localhost name


References
- http://chadstechnoworks.com/wptech/os/how_to_change_hostname_in_macos_x.html
- https://answers.uillinois.edu/illinois/page.php?id=108423
- https://osxdaily.com/2010/09/06/change-your-mac-hostname-via-terminal/
- https://forums.macrumors.com/threads/rename-harddrive-volume-via-terminal.1301975/
