Changing the hostname on a macOS system allows you to assign a unique name to your device within a network. By default, macOS gives your device a generic name like MacBook-Pro. Customizing the hostname is important if you have multiple Mac devices on the same network.
There are two primary methods to change the hostname in macOS. You can do it through System Preferences for a graphical approach or use the Terminal for a more direct method. Both methods will effectively update your machine’s identity on the network.
For IT professionals, using the Terminal to change the hostname provides more control and can be useful for scripting. Whether you prefer the System Preferences or the Terminal, updating the hostname is a simple process.
Methods to change hostname in macOS:




$ sudo scutil --set HostName newhostname
$ hostname newhostname