Change hostname in macOS

Apple by default set the hostname of your machine in the <name>-<machine-type> format. For example, it could be Myname-MacBook-Pro. You can change the hostname both via System Preferences and the Terminal.

Change Hostname in macOS via System Preferences

  1. Open System Preferences from the Apple menu.
  2. Open Sharing preferences by clicking on the Sharing icon.
  3. Change the current hostname to your desired hostname at the Computer Name field.

Change Hostname in macOS via terminal

  1. Open Terminal via Spotlight.
  2. Set new hostname via scutil using sudo.
    $ sudo scutil --set HostName newhostname

Sign up for Mac OS X Superuser - Use Mac OS X like a Pro and many other great courses on Udemy to learn more.

Written by Mohd Shakir Zakaria. Last updated on 2019-02-12