Changing the hostname of your macOS system can help you distinguish between different machines in a network, especially if you have multiple Mac devices. By default, macOS assigns a generic hostname like MacBook-Pro but it can be easily customized to something more meaningful.

While changing the hostname through the System Preferences is simple, you can also utilize the Terminal for a more direct approach. Both methods effectively update your machine's identity on networks and when accessed remotely.

Methods to change hostname in macOS:

Change Hostname in macOS via System Preferences

  1. Open System Preferences from the Apple menu.
  2. Click on the Sharing icon.
  3. Type in your desired hostname under the Computer Name field.
  4. Close the Sharing window for the changes to take effect.

Change Hostname in macOS via terminal

  1. Launch the Terminal application using Spotlight.
  2. Set new hostname via scutil using sudo.
    $ sudo scutil --set HostName newhostname
  3. Verify the change.
    $ hostname
  4. Close the Terminal.
Discuss the article:

Comment anonymously. Login not required.